private void SendInternal(IMessageTree tree) { if (_mActiveChannel != null && _mActiveChannel.Connected) { // Re-use the existing buffer. buf.Reset(); _mCodec.Encode(tree, buf); // Nullify reference as early as possible tree.Message = null; byte[] data = buf.ToArray(); _mActiveChannel.Client.Send(data); if (_mStatistics != null) { _mStatistics.OnBytes(data.Length); } } else { tree.Message = null; Logger.Warn("SendInternal中,Socket关闭"); } }
public override String ToString() { PlainTextMessageCodec codec = new PlainTextMessageCodec(); ChannelBuffer buf = new ChannelBuffer(8192); codec.EncodeMessage(this, buf); buf.Reset(); return(buf.ToString()); }
public override string ToString() { PlainTextMessageCodec codec = new PlainTextMessageCodec(); ChannelBuffer buf = new ChannelBuffer(8192); codec.Encode(this, buf); buf.Reset(); buf.Skip(4); // get rid of length return(buf.ToString()); }
public override String ToString() { try { PlainTextMessageCodec codec = new PlainTextMessageCodec(); ChannelBuffer buf = new ChannelBuffer(8192); codec.EncodeMessage(this, buf); buf.Reset(); return(buf.ToString()); } catch (Exception ex) { Cat.lastException = ex; return(""); } }
public override String ToString() { try { PlainTextMessageCodec codec = new PlainTextMessageCodec(); ChannelBuffer buf = new ChannelBuffer(8192); codec.Encode(this, buf); buf.Reset(); buf.Skip(4); // get rid of length return buf.ToString(); } catch (Exception ex) { Cat.lastException = ex; return ""; } }