GNE
0.75.0
|
The EmptyPacket is a packet that has no information. More...
#include <EmptyPacket.h>
Public Types | |
typedef SmartPtr< EmptyPacket > | sptr |
typedef WeakPtr< EmptyPacket > | wptr |
![]() | |
typedef SmartPtr< Packet > | sptr |
typedef WeakPtr< Packet > | wptr |
Public Member Functions | |
EmptyPacket () | |
Constructs an EmptyPacket. | |
![]() | |
Packet * | makeClone () const |
Returns a newly allocated exact copy of this packet, using the PacketParser::clonePacket function. | |
int | getType () const |
Returns the type of this instance. | |
virtual int | getSize () const |
Returns the current size of this packet in bytes. | |
virtual void | writePacket (Buffer &raw) const |
Writes the packet to the given Buffer. | |
virtual void | readPacket (Buffer &raw) |
Reads this packet from the given Buffer. |
Static Public Attributes | |
static const int | ID = 0 |
The ID for this type of packet. |
Additional Inherited Members | |
![]() | |
Packet (int id) | |
Constructs a packet with the given ID. | |
Packet (const Packet &o) | |
Copy constructor. | |
Packet & | operator= (const Packet &rhs) |
Copy operator you can use to help you in creating your own. |
The EmptyPacket is a packet that has no information.
This packet type is a replacement for when Packet with a default constructor was used. Normally sending blank packets are not useful; however, there are a few purposes for them, such as a "keep alive" packet to keep a connection alive. If you are wanting to use a blank packet for some purpose such as a end-of-data marker or sending some message that requires no data, it is suggested that you simply derive a class from Packet that adds no data, but has a unique ID so it can be "recognized" easier.