private void TestEcho(Packet packet) { //echo to client mChannel.Send( SendBuf.From(Encoding.UTF8.GetBytes("echo ")), SendBuf.From(packet.Bytes, 0, packet.Length)); }
public static SendBuf From(byte[] buf, int off, int len) { var sendBuf = new SendBuf(); sendBuf.off = off; sendBuf.len = len; sendBuf.buf = buf; return(sendBuf); }
public void OnMsg(Packet packet) { //首次连接第一个协议必须是user token var protoPacket = ProtoPacket.FromRecvBuf(packet.Bytes, 0, packet.Length); if (protoPacket.ProtoObj is PTestDemoClsReq req) { var f1 = req.F1; if (f1 == null) { DCLog.Log("default is null"); } } //echo to client mChannel.Send( SendBuf.From(Encoding.UTF8.GetBytes("echo ")), SendBuf.From(packet.Bytes, 0, packet.Length)); }
private void Send(int id, byte[] content) { mChannel.Send(SendBuf.From(DCGameProtocol.GetIntBuf(id)), SendBuf.From(content)); }