Example #1
0
        /// <summary>
        /// 发送网络消息
        /// </summary>
        /// <param name="opCode"></param>
        /// <param name="subCode"></param>
        /// <param name="value"></param>
        public void Send(int opCode, int subCode, object value)
        {
            SocketMsg msg = new SocketMsg(opCode, subCode, value);

            byte[] data   = EncoderTool.EncodeMsg(msg);
            byte[] packet = EncoderTool.EnconderPacket(data);

            Send(packet);
        }
Example #2
0
        /// <summary>
        /// 发送网络消息
        /// </summary>
        /// <param name="opCode"></param>
        /// <param name="subCode"></param>
        /// <param name="value"></param>
        public void Send(int opCode, int subCode, object value)
        {
            SocketMsg msg = new SocketMsg(opCode, subCode, value);

            byte[] data   = EncoderTool.EncodeMsg(msg);
            byte[] packet = EncoderTool.EncoderPacket(data);

            sendQueue.Enqueue(packet);

            if (!isSendProcess)
            {
                ProcessSend();
            }
            //try
            //{ clientSocket.Send(packet); }
            //catch (Exception e)
            //{ Console.WriteLine(e.Message); }
        }