public static void CancelConnection (IAsyncResult asyncResult) { ((Socket)asyncResult.AsyncState).Close (); } }