public static int Close(IntPtr socket) { Debug.WriteLine("Closing socket " + socket.ToInt32()); int ret, ret2; m_netSocketInterface.Shutdown(socket, out ret2); m_netSocketInterface.Close(socket, out ret); Debug.WriteLine("Closed Socket: " + ret + " Shutdown: " + ret2); if (ret2 == SOCKET_ERROR) { Debug.WriteLine("Error: " + GetLastError()); } return(ret); }