/** *发送 */ public void Send(Frame frame) { try { if (this.status == STATUS_CONNECTED) { this.sending++; ByteBuf bb = frame.GetData(); SocketAsyncEventArgs arg = new SocketAsyncEventArgs(); arg.SetBuffer(bb.GetRaw(), bb.ReaderIndex(), bb.ReadableBytes()); arg.UserToken = bb; arg.Completed += new EventHandler <SocketAsyncEventArgs>(OnSend); this.clientSocket.SendAsync(arg); } } catch (Exception ex) { this.Close(false); } }
/** *发送 */ public IAsyncResult Send(Frame frame) { return(this.Send(frame.GetData())); }
/** *发送 */ public IAsyncResult Send(Frame frame) { return this.Send (frame.GetData ()); }