public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state) { try { return(socket.BeginSend(buffer, offset, size, SocketFlags.None, callback, state)); } catch (Exception ex) { if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException) { throw; } throw new IOException(ex.Message, ex); } }
private void SendData(ISocket client, string data) { byte[] byteData = Encoding.ASCII.GetBytes(data); client.BeginSend(byteData, 0, byteData.Length, 0, SendDataComplete, client); }