Spinach.AsynchronousClient.SendCallback C# (CSharp) Method

SendCallback() private method

private SendCallback ( IAsyncResult ar ) : void
ar IAsyncResult
return void
        private void SendCallback(IAsyncResult ar)
        {
            try
            {
                // Retrieve the socket from the state object.
                Socket client = (Socket)ar.AsyncState;

                // Complete sending the data to the remote device.
                int bytesSent = client.EndSend(ar);
                Console.WriteLine("Sent {0} bytes to server.", bytesSent);

                // Signal that all bytes have been sent.
                sendDone.Set();
            }
            catch (Exception e)
            {
                //System.Windows.Forms.MessageBox.Show(e.Message, "Send callback exception");
                Console.WriteLine(e.Message);
            }
        }
    }