19 #ifndef __UT_NetPacket__
20 #define __UT_NetPacket__
47 unsigned read_bufsize=0);
52 int64 getMemoryUsage(
bool inclusive)
const;
74 static const char *getHost();
77 static const char *getUserHost();
80 static int matchIPMask(
const char *
mask,
85 static bool matchServerClientIPs(
88 const char *mask_pattern);
96 static UT_NetSocket *connectToServer(
const char *host = 0,
101 static int getDefaultServerPort();
107 PacketCompress = 0x01,
118 return writeData(sock, data, strlen(data)+1);
135 int readPacketLength(
UT_NetSocket &sock,
int *timeout_ms = NULL);
136 int readPacketLength(
UT_NetSocket &sock,
int *timeout_ms,
141 int *timeout_ms = NULL);
143 unsigned int len,
int *timeout_ms = NULL);
145 int *timeout_ms,
int &status);
147 unsigned int len,
int *timeout_ms,
153 int timeout_ms,
int &status);
155 int timeout_ms = -1);
162 int timeout_ms,
int &status);
164 int timeout_ms = -1);
168 unsigned len,
int timeout = -1);
170 unsigned len,
int timeout,
int &status);
175 int timeout_ms = -1);
177 int timeout_ms,
int &status);
179 void setFlag(
unsigned flag) { myFlag |= flag; }
181 int getFlag(
unsigned flag)
const {
return myFlag & flag; }
186 if (maxsize > myDataSize)
187 growBuffer(maxsize,
true);
191 void *rcode = myData;
199 void growBuffer(
unsigned len,
bool doshrink=
false);
203 int *timeout_ms,
int &status);
206 char *myWriteBuf, *myWriteCurr, *myWriteEnd;
207 char *myReadBuf, *myReadCurr, *myReadLast, *myReadEnd;
215 int timeout_ms,
int &status)
234 return readPacket(sock, len, timeout_ms, status);
240 int timeout_ms,
int& status)
243 if (len > 0 && len <= size)
258 return readPacket(sock, data, size, timeout_ms, status);
GLenum GLuint GLenum GLsizei const GLchar * buf
int writeData(UT_NetSocket &sock, const char *data)
void writeData(std::ostream &os, const T *data, Index count, uint32_t compression)
This represents a Ipv4 address.
int readPacketLength(UT_NetSocket &sock, int *timeout_ms=NULL)
void * readPacket(UT_NetSocket &sock, unsigned &len, int timeout_ms, int &status)
void clearFlag(unsigned flag)
int getFlag(unsigned flag) const
unsigned getDataSize() const
GLbitfield GLuint64 timeout
void limitDataSize(unsigned maxsize=4096)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
int readPacketData(UT_NetSocket &sock, void *buf, unsigned len, int *timeout_ms=NULL)
void setFlag(unsigned flag)