29 #ifndef LINESOCKET_HDR 30 #define LINESOCKET_HDR 84 int getLine(
char * buf,
unsigned int maxsize) {
88 std::cerr << boost::format(
"READ Got ret = %d errno = %d ready = %c\n")
89 % gotbytes % errno % ((char) (
isReady() ?
'T' :
'F'));
91 if((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
92 std::cerr << boost::format(
"READ got ret = %d errno = %d\n")
108 for(
int i = 0; i < gotbytes; i++) {
119 for(
unsigned int i = 0; i < maxsize; i++) {
130 buf[maxsize-1] =
'\000';
132 for(ch =
'\000'; (ch !=
'\n') && !
inbuf.empty(); ) {
The Baseclass for all SoDa objects, and useful commonly used classes.
int getLine(char *buf, unsigned int maxsize)
capture a newline-terminated buffer from the socket This is a non-blocking method.
LineServerSocket(int portnum, TransportType transport=TCP)
constructor
std::queue< char > inbuf
Do this the simple way – accumulate characters in a queue then return each "\n" terminated substring...
static const unsigned int temp_buf_size
This is the size of the running buffer that we read into from the socket.
char temp_buf[temp_buf_size]
This is the running buffer that we read into from the socket.
This is an IP socket that returns newline-delimited strings arriving on the socket.
int ready_line_count
keep a count of the number of "\n" delimited strings we've seen that haven't yet been returned from g...