Packet
Represents a data packet that carries the specified payload. It has the specified sequenceNumber and optionally acknowledges the specified acknowledgeSequenceNumber to the remote peer. The specified expirationTime indicates when the packet is due for (re)transmission.
The sequenceNumber is the number of bytes send prior to this packet and wraps around the 16bit unsigned integer boundary. It is used to let the remote know in which order to put incoming packets together and to know if there are any holes between the received packets.
When a packet is received the other side should acknowledge all packets received in sequence by sending back a packet with the highest sequenceNumber received in order, without holes, plus the size of the payload of that packet.
Initially the expirationTime will be the current time, indicating that the packet should be send immediately. After sending it is typically incremented by the send timeout.
Constructors
Types
Properties
Functions
Returns the sequence number that should be used to acknowledge this packet.
Returns true
if this packet is acknowledged by the specified acknowledgeSequenceNumber. Note that wrap around of the sequence numbers is taken into account. It is assumed that the transfer window is small enough that much less than half the sequence number space if ever in use at any point in time.
Encodes the packet to a ByteArray.