|
HDK
|
#include <UT_NetPacket.h>
Public Types | |
| enum | { PacketCompress = 0x01, PacketCrypt = 0x02 } |
Public Member Functions | |
| UT_NetPacket (unsigned write_bufsize=4096, unsigned read_bufsize=0) | |
| ~UT_NetPacket () | |
| int64 | getMemoryUsage (bool inclusive) const |
| int | writeData (UT_NetSocket &sock, const void *data, unsigned len) |
| int | writeData (UT_NetSocket &sock, const char *data) |
| bool | write (UT_NetSocket &sock, const UT_WorkBuffer &data) |
| int | flush (UT_NetSocket &sock) |
| int | readPacketLength (UT_NetSocket &sock, int *timeout_ms=NULL) |
| int | readPacketLength (UT_NetSocket &sock, int *timeout_ms, int &status) |
| int | readPacketData (UT_NetSocket &sock, void *buf, unsigned len, int *timeout_ms=NULL) |
| int | readPacketData (UT_NetSocket &sock, UT_WorkBuffer &buf, unsigned int len, int *timeout_ms=NULL) |
| int | readPacketData (UT_NetSocket &sock, void *buf, unsigned len, int *timeout_ms, int &status) |
| int | readPacketData (UT_NetSocket &sock, UT_WorkBuffer &buf, unsigned int len, int *timeout_ms, int &status) |
| void * | readPacket (UT_NetSocket &sock, unsigned &len, int timeout_ms, int &status) |
| void * | readPacket (UT_NetSocket &sock, unsigned &len, int timeout_ms=-1) |
| unsigned | readPacket (UT_NetSocket &sock, void *data, unsigned size, int timeout_ms, int &status) |
| unsigned | readPacket (UT_NetSocket &sock, void *data, unsigned size, int timeout_ms=-1) |
| bool | read (UT_NetSocket &sock, UT_WorkBuffer &wbuf, unsigned len, int timeout=-1) |
| bool | read (UT_NetSocket &sock, UT_WorkBuffer &wbuf, unsigned len, int timeout, int &status) |
| unsigned | readPacket (UT_NetSocket &sock, UT_WorkBuffer &wbuf, int timeout_ms=-1) |
| unsigned | readPacket (UT_NetSocket &sock, UT_WorkBuffer &wbuf, int timeout_ms, int &status) |
| void | setFlag (unsigned flag) |
| void | clearFlag (unsigned flag) |
| int | getFlag (unsigned flag) const |
| unsigned | getDataSize () const |
| void | limitDataSize (unsigned maxsize=4096) |
| void * | steal () |
Static Public Member Functions | |
| static UT_NetSocket * | acceptClient (UT_NetSocket &server, int blocking=1, int timeout=10) |
| static const char * | getHost () |
| static const char * | getUserHost () |
| static int | matchIPMask (const char *mask, const char *address, UT_NetSocket *socket) |
| static bool | matchServerClientIPs (const UT_IpAddressV4 &server, const UT_IpAddressV4 &client, const char *mask_pattern) |
| static UT_NetSocket * | connectToServer (const char *host=0, int port=-1, int blocking=1, int timeout=5) |
| static int | getDefaultServerPort () |
| static void | disconnectFromServer (UT_NetSocket *socket) |
Use NET_PacketSocket instead of UT_NetPacket. UT_NetPacket has a lot of short comings when something unexpected occurs. UT_NetPacket also doesn't support async very well. Additionally, its very difficult to get proper error information when something goes wrong.
Definition at line 38 of file UT_NetPacket.h.
| anonymous enum |
| Enumerator | |
|---|---|
| PacketCompress | |
| PacketCrypt | |
Definition at line 106 of file UT_NetPacket.h.
|
explicit |
| UT_NetPacket::~UT_NetPacket | ( | ) |
|
static |
|
inline |
Definition at line 180 of file UT_NetPacket.h.
|
static |
|
static |
| int UT_NetPacket::flush | ( | UT_NetSocket & | sock | ) |
|
inline |
Definition at line 183 of file UT_NetPacket.h.
|
static |
|
inline |
Definition at line 181 of file UT_NetPacket.h.
|
static |
| int64 UT_NetPacket::getMemoryUsage | ( | bool | inclusive | ) | const |
|
static |
|
inline |
Definition at line 184 of file UT_NetPacket.h.
|
static |
|
static |
| bool UT_NetPacket::read | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | wbuf, | ||
| unsigned | len, | ||
| int | timeout = -1 |
||
| ) |
| bool UT_NetPacket::read | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | wbuf, | ||
| unsigned | len, | ||
| int | timeout, | ||
| int & | status | ||
| ) |
|
inline |
Definition at line 214 of file UT_NetPacket.h.
|
inline |
Definition at line 231 of file UT_NetPacket.h.
|
inline |
Definition at line 239 of file UT_NetPacket.h.
|
inline |
Definition at line 254 of file UT_NetPacket.h.
| unsigned UT_NetPacket::readPacket | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | wbuf, | ||
| int | timeout_ms = -1 |
||
| ) |
| unsigned UT_NetPacket::readPacket | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | wbuf, | ||
| int | timeout_ms, | ||
| int & | status | ||
| ) |
| int UT_NetPacket::readPacketData | ( | UT_NetSocket & | sock, |
| void * | buf, | ||
| unsigned | len, | ||
| int * | timeout_ms = NULL |
||
| ) |
| int UT_NetPacket::readPacketData | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | buf, | ||
| unsigned int | len, | ||
| int * | timeout_ms = NULL |
||
| ) |
| int UT_NetPacket::readPacketData | ( | UT_NetSocket & | sock, |
| void * | buf, | ||
| unsigned | len, | ||
| int * | timeout_ms, | ||
| int & | status | ||
| ) |
| int UT_NetPacket::readPacketData | ( | UT_NetSocket & | sock, |
| UT_WorkBuffer & | buf, | ||
| unsigned int | len, | ||
| int * | timeout_ms, | ||
| int & | status | ||
| ) |
| int UT_NetPacket::readPacketLength | ( | UT_NetSocket & | sock, |
| int * | timeout_ms = NULL |
||
| ) |
| int UT_NetPacket::readPacketLength | ( | UT_NetSocket & | sock, |
| int * | timeout_ms, | ||
| int & | status | ||
| ) |
|
inline |
Definition at line 179 of file UT_NetPacket.h.
|
inline |
Definition at line 189 of file UT_NetPacket.h.
| bool UT_NetPacket::write | ( | UT_NetSocket & | sock, |
| const UT_WorkBuffer & | data | ||
| ) |
| int UT_NetPacket::writeData | ( | UT_NetSocket & | sock, |
| const void * | data, | ||
| unsigned | len | ||
| ) |
|
inline |
Definition at line 116 of file UT_NetPacket.h.