protected override void Handle(Login message, ITcpSocket socket)
        {
            Console.WriteLine(string.Format("Server: HandleLogin for {0} {1}", message.Name, message.Hash));

            // echo data back
            byte[] data = Serialize(message);
            socket.Send(data);
        }
예제 #2
0
            protected void Send(ITcpSocket socket, ushort opCode, IBuffer response)
            {
                byte[]  payload = response.GetAllBytes();
                int     opSize  = 2;
                int     size    = payload.Length + opSize;
                IBuffer buffer  = new StreamBuffer();

                buffer.SetPositionStart();
                buffer.WriteInt16((short)size, Endianness.Big);
                buffer.WriteInt16(opCode, Endianness.Big);
                buffer.WriteBytes(payload);
                socket.Send(buffer.GetAllBytes());
                PacketLogOut(buffer);
            }
예제 #3
0
 public void Send(Packet packet)
 {
     byte[] data;
     try
     {
         data = _packetFactory.Write(packet);
     }
     catch (Exception ex)
     {
         Logger.Exception(this, ex);
         return;
     }
     // Logger.LogOutgoingPacket(this, packet, ServerType);
     _socket.Send(data);
 }
예제 #4
0
        public void Send(BafPacket packet)
        {
            byte[] data;
            try
            {
                data = _packetFactory.Write(packet);
            }
            catch (Exception ex)
            {
                Logger.Exception(this, ex);
                return;
            }

            if (data == null)
            {
                Logger.Error(this, $"No data produced to send for packetId: {packet.Id}");
                return;
            }

            _socket.Send(data);
        }
 private void Send(ITcpSocket client, Message message)
 {
     byte[] data = _consumer.Serialize(message);
     client.Send(data);
 }
예제 #6
0
 void SendReceiptAcknowledgement()
 {
     socket.Send("#00073 ");
 }