Packet

Utility class to build blocks of data to transfer over the network.

Constructors

this
this()

Default constructor.

Destructor

~this
~this()

Destructor.

Members

Functions

append
void append(const(void)[] data)

Append data to the end of the packet.

clear
void clear()

Clear the packet.

endOfPacket
bool endOfPacket()

Tell if the reading position has reached the end of the packet.

getData
const(void)[] getData()

Get a slice of the data contained in the packet.

onRecieve
void onRecieve(const(void)[] data)

Called after the packet is received over the network.

onSend
const(void)[] onSend()

Called before the packet is sent over the network.

read
bool read(out T value)
bool read(out T value)

Reads a primitive data type or string from the packet.

write
void write(T value)
void write(T value)

Writes a scalar data type or string to the packet.

Meta