private void SendCallback(IAsyncResult ar) { try { // Complete sending the data to the remote device. int bytesSent = _socket.EndSend(ar); } catch (ObjectDisposedException e) { Console.WriteLine("Failed to send data as socket was disposed."); } catch (SocketException e) { } }