Packet

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

Packets provide a safe and easy way to serialize data, in order to send it over the network using sockets (sf::TcpSocket, sf::UdpSocket).

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.

canRead
bool canRead()

Test the validity of a packet, for reading

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.

readBool
bool readBool()

Reads a bool from the packet.

readByte
byte readByte()

Reads a byte from the packet.

readDouble
double readDouble()

Reads a double from the packet.

readDstring
dstring readDstring()

Reads a dstring from the packet.

readFloat
float readFloat()

Reads a float from the packet.

readInt
int readInt()

Reads a int from the packet.

readShort
short readShort()

Reads a short from the packet.

readString
string readString()

Reads a string from the packet.

readUbyte
ubyte readUbyte()

Reads a ubyte from the packet.

readUint
uint readUint()

Reads a uint from the packet.

readUshort
ushort readUshort()

Reads a ushort from the packet.

readWstring
wstring readWstring()

Reads a wstring from the packet.

writeBool
void writeBool(bool value)

Write a bool the the end of the packet.

writeByte
void writeByte(byte value)

Write a byte the the end of the packet.

writeDouble
void writeDouble(double value)

Write a double the the end of the packet.

writeDstring
void writeDstring(dstring value)

Write a dstring the the end of the packet.

writeFloat
void writeFloat(float value)

Write a float the the end of the packet.

writeInt
void writeInt(int value)

Write a int the the end of the packet.

writeShort
void writeShort(short value)

Write a short the the end of the packet.

writeString
void writeString(string value)

Write a string the the end of the packet.

writeUbyte
void writeUbyte(ubyte value)

Write a ubyte the the end of the packet.

writeUint
void writeUint(uint value)

Write a uint the the end of the packet.

writeUshort
void writeUshort(ushort value)

Write a ushort the the end of the packet.

writeWstring
void writeWstring(wstring value)

Write a wstring the the end of the packet.

Variables

sfPtr
sfPacket* sfPtr;
Undocumented in source.

Meta