35#include <SoDa/Format.hxx>
84 int getLine(
char * buf,
unsigned int maxsize) {
88 std::cerr << SoDa::Format(
"READ Got ret = %0 errno = %1 ready = %2\n")
91 .addC((
char) (
isReady() ?
'T' :
'F'));
93 if((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
94 std::cerr << SoDa::Format(
"READ got ret = %0 errno = %1\n")
111 for(
int i = 0; i < gotbytes; i++) {
122 for(
unsigned int i = 0; i < maxsize; i++) {
133 buf[maxsize-1] =
'\000';
135 for(ch =
'\000'; (ch !=
'\n') && !
inbuf.empty(); ) {
The Baseclass for all SoDa objects, and useful commonly used classes.
LineServerSocket(int portnum, TransportType transport=TCP)
constructor
int getLine(char *buf, unsigned int maxsize)
capture a newline-terminated buffer from the socket This is a non-blocking method.
char temp_buf[temp_buf_size]
This is the running buffer that we read into from the socket.
static const unsigned int temp_buf_size
This is the size of the running buffer that we read into from 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...
std::queue< char > inbuf
Do this the simple way – accumulate characters in a queue then return each "\n" terminated substring ...
ServerSocket(int portnum, TransportType transport=TCP)