public void Send(int opCode, int subCode, object value) { SocketMsg msg = new SocketMsg(opCode, subCode, value); byte[] packet = EncodeTool.EncodeMessage((EncodeTool.EncodeMsg(msg))); sendMsgQueue.Enqueue(packet); if (!isSend) { SendProcess(); } }
private void ProcessReceive() { isProcess = true; byte[] data = EncodeTool.DecodeMessage(dataCache); if (data == null) { isProcess = false; return; } SocketMsg msg = EncodeTool.DecodeMsg(data); if (receiveCompleted != null) { receiveCompleted.Invoke(this, msg); } ProcessReceive(); }