42 if ((ret = s_.
read (b_.
m_ptr, expected)) <= 0)
45 if (WSAGetLastError () != WSAEWOULDBLOCK) {
51 if (errno != EWOULDBLOCK) {
85 m_buf =
new char[sz_];
135 int unit_sz =
sizeof (int);
136 memcpy ((
char*) &val,
m_ptr, unit_sz);
139 n_ = (int) ntohl (val);
160 char* cptr =
m_ptr + 4;
184 int unit_sz =
sizeof (float);
185 memcpy ((
char*) &val,
m_ptr, unit_sz);
189 xdrmem_create (&xdrs, (caddr_t) &val, unit_sz, XDR_DECODE);
190 xdr_float (&xdrs, &n_);
231 "\tm_buf ........: 0x%x \n" \
232 "\tm_sz .........: %d \n" \
233 "\tm_ptr ........: 0x%x \n" \
234 "\tbytes left ...: %d \n" \
235 "\tm_state ......: %s \n\n",
xdrIOBuffer(u_int len_)
Constructor.
int size() const
Return number of bytes in xdrIOBuffer.
~xdrIOBuffer()
Destructor.
static size_t xdr_length(const std::string &s_)
Give the true length of the XDR-encoded STL string.
state_t m_state
Object state.
char * m_ptr
Pointer for next I/O operation into the buffer.
int m_sz
Buffer size and maximum expected size.
int getBytesAvail(void) const
Return number of bytes available in socket receive buffer.
#define DL(X)
A macro for writing debug message to the Logger.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
xdrIOBuffer & operator=(const xdrIOBuffer &rhs_)
Assign operator.
virtual int read(char *buf_, const u_int size_)
Read expected number of bytes from the socket.
#define EL(X)
A macro for writing error message to the Logger.
void dump() const
Dump object's internal state to the log file.
const char * getMemDump() const
Obtain a pointer to the dump image (null-terminated char string).
Extended xdrIOBuffer messages.
This class allows to read XDR-encoded data from Socket stream asynchronously and then read from it as...
XDRHack provides XDR definitions for systems that have them missing.
void reset()
Clear up the internal buffer and reset state to waiting.
A Hex/Ascii memory dump of similar to od(1) UNIX utility.
Socket & operator>>(Socket &s_, CharInBuffer &b_)
Regardless of the delimeter size, which can be >1, add the character received to the buffer and compa...
friend Socket & operator>>(Socket &src_, xdrIOBuffer &dest_)
Read raw data from Socket nonblocking and store into internal buffer.
string get_state() const
Give verbal interpretation of object's state.
void copy(const xdrIOBuffer &)
Copy object from argument.
Class xdrIOBuffer messages.