private void SendCallback(IAsyncResult ar) { try { Socket client = (Socket)ar.AsyncState; int bytesSent = client.EndSend(ar); sendDone.Set(); } catch (Exception e) { Console.WriteLine(e.ToString()); } }