I am using .Net\'s socket class and I am using the following code:
socket.Shutdown(SocketShutdown.Both);
socket.Disconnect(true);
This then
It takes 2 min because the server probably did'nt close the socket when it received 0 bytes from the shutdown call of the client.
So client call shutdown. The server receive 0 bytes. Client call Disconnect : disconnect will wait the close of the socket from the server side. If the server don't close the socket, the disconnect of the client will take 2 min (timeout). If the server close the socket, the disconnect will be almost immediate.