public byte[] ToBuffer() { var buffer = new MemoryStream(); BufferHelper.WriteShort((short)Common.PacketType.CONTROL_CLIENT_CLOSE, buffer); return(PayloadPacket.appendPayload(buffer, Payload)); }
public static StreamCreatePacket ReadBuffer(short packetType, NetworkStream buffer) { var streamChannelId = BufferHelper.ReadInt(buffer); var payload = PayloadPacket.readPayload(buffer); return(new StreamCreatePacket(streamChannelId, payload)); }
public static ControlHandshakePacket ReadBuffer(short packetType, NetworkStream buffer) { var messageId = BufferHelper.ReadInt(buffer); var payload = PayloadPacket.readPayload(buffer); var helloPacket = new ControlHandshakePacket(payload); helloPacket.RequestId = messageId; return(helloPacket); }
public byte[] ToBuffer() { var buffer = new MemoryStream(); BufferHelper.WriteShort((short)Common.PacketType.CONTROL_HANDSHAKE, buffer); BufferHelper.WriteInt(RequestId, buffer); return(PayloadPacket.appendPayload(buffer, Payload)); }
public static ResponsePacket ReadBuffer(short packetType, NetworkStream buffer) { var messageId = BufferHelper.ReadInt(buffer); var payload = PayloadPacket.readPayload(buffer); var responsePacket = new ResponsePacket(payload); responsePacket.RequestId = messageId; return(responsePacket); }
public byte[] ToBuffer() { var buffer = new MemoryStream(); BufferHelper.WriteShort((short)Common.PacketType.APPLICATION_RESPONSE, buffer); BufferHelper.WriteInt(RequestId, buffer); return(PayloadPacket.appendPayload(buffer, Payload)); }
public byte[] ToBuffer() { var buffer = new MemoryStream(); BufferHelper.WriteShort(PACKET_TYPE, buffer); BufferHelper.WriteInt(StreamChannelId, buffer); return(PayloadPacket.appendPayload(buffer, Payload)); }
public static ClientClosePacket ReadBuffer(short packetType, NetworkStream buffer) { var payload = PayloadPacket.readPayload(buffer); if (payload == null) { return(null); } var requestPacket = new ClientClosePacket(); requestPacket.Payload = payload; return(requestPacket); }