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); }
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); }
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); }
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); }
void SendReceiptAcknowledgement() { socket.Send("#00073 "); }