public ClientInfo() { buf = new byte[bufsize]; tmpbuf = new byte[2 * bufsize]; ReqQueue = new ConcurrentQueue <UserReq>(); mrevent = new ManualResetEvent(false); MsgHeader = new AppMsgHeader(); }
private byte[] ResponseBytes(string funid, string dtime, string msgid, string channel, string jsonbody) { AppMsgHeader header = new AppMsgHeader(); byte[] body = Encoding.UTF8.GetBytes(jsonbody); byte[] msg = new byte[AppMsgHeader.HeaderLen + body.Length]; Array.Clear(msg, 0, msg.Length); //int blength = body.Length; header.FunctionID = Encoding.UTF8.GetBytes(funid); header.DateTime = Encoding.UTF8.GetBytes(dtime); header.DataLen = Encoding.UTF8.GetBytes(body.Length.ToString("D5")); header.MsgID = Encoding.UTF8.GetBytes(msgid); header.Channel = Encoding.UTF8.GetBytes(channel); Array.Copy(header.HeaderData, 0, msg, 0, AppMsgHeader.HeaderLen); Array.Copy(body, 0, msg, AppMsgHeader.HeaderLen, body.Length); return(msg); }