Ejemplo n.º 1
0
        private void CreateMessage(ByteBuffer buffer)
        {
            int        type = buffer.readInt();
            ByteBuffer buf  = new ByteBuffer(type, header - 4);

            buf.Type = type;
            buf.writeBytes(buffer.getBuffer(), 4, this.header - 4);

            if (type != 1001 && type != 1002)
            {
                if (this.user == null)
                {
                    //用户没登陆
                    this.send(ConstomMessage.getError("用户没登陆"));
                    return;
                }
            }
            MessageNode node;

            node.Type   = type;
            node.buffer = buf;
            node.socket = this;
            node.Method = null;
            Server.addReciveTask(node);
        }
Ejemplo n.º 2
0
 public void Close()
 {
     if (this.socket != null)
     {
         this.socket.Close();
         this.socket = null;
     }
     if (one < 1)
     {
         one = 1;
         MessageNode node;
         node.Type   = 0;
         node.socket = null;
         node.buffer = null;
         node.Method = ClentExit;
         Server.addReciveTask(node);
     }
 }