public override int ReadPayload(MemoryStream stream, int length) { //Debug.Assert(length == NodeAddress.LEN + sizeof(short), "G2PacketD : supposed to read " + (NodeAddress.LEN + sizeof(short)) + " but has to read " + length); Node = NodeAddress.ReadNodeAddress(stream); length = (short)BinaryUtils.getVariableIntLE(stream, 2); return(NodeAddress.LEN + 2); }
public override int ReadPayload(MemoryStream stream, int length) { //Debug.Assert(NodeAddress.LEN == length, "G2PacketNA supposed to read " + NodeAddress.LEN + " but have to read " + length); node = NodeAddress.ReadNodeAddress(stream); if (node == null) { return(0); } return(NodeAddress.LEN); }
public override int ReadPayload(MemoryStream stream, int length) { ////Debug.Assert (length % 6 == 0, "G2PacketALT alternate locations bytes not multiple of 6 bytes"); int size = (int)(length / 6); Addresses = new NodeAddress[size]; for (int i = 0; i < size; i++) { Addresses [i] = NodeAddress.ReadNodeAddress(stream); } return(length); }
public override int ReadPayload(MemoryStream stream, int length) { int timestampLength = (int)(length - NodeAddress.LEN); //Debug.Assert(timestampLength == 4 || timestampLength == 0, "G2PacketS : timestamp 0 or 4 bytes but here has to read " + timestampLength); Node = NodeAddress.ReadNodeAddress(stream); if (timestampLength == 4) { Timestamp = (int)BinaryUtils.getVariableIntLE(stream, timestampLength); } return(length); }
public override int ReadPayload(System.IO.MemoryStream stream, int length) { //Debug.Assert(NodeAddress.LEN == length, "G2PacketUDP supposed to read " + NodeAddress.LEN + " but has to read " + length); EndPoint = NodeAddress.ReadNodeAddress(stream); return(6); }