Example #1
0
    //发送数据
    public static void Send(IMessage msg)
    {
        //状态判断
        if (isConnecting)
        {
            return;
        }
        if (isClosing)
        {
            return;
        }

        byte[] sendBytes = MsgHelper.Encode(msg);

        //写入队列
        ByteArray ba = new ByteArray(sendBytes);

        lock (writeQueue) {
            writeQueue.Enqueue(ba);
        }
    }