17 bool readline(
Socket& sck, std::string& s,
bool* timeout_exit,
unsigned int timeout_secs,
21 *timeout_exit =
false;
24 unsigned timeouts_left = timeout_secs / 2;
29 timeouts_left = timeout_secs / 2;
33 if ( maxlen && s.length() > maxlen )
47 if ( timeout_secs && !--timeouts_left )
60 sck.
send( (
void*)s.c_str(),
static_cast<unsigned int>( s.length() ) );
61 sck.
send(
"\r\n", 2 );
64 bool readstring(
Socket& sck, std::string& s,
unsigned int interchar_secs,
unsigned length )
68 unsigned timeouts_left = interchar_secs / 2;
73 timeouts_left = interchar_secs / 2;
76 if ( s.length() == length )
83 if ( !--timeouts_left )
bool recvbyte(unsigned char *byte, unsigned int waitms)
void writeline(Socket &sck, const std::string &s)
bool readline(Socket &sck, std::string &s, bool *timeout_exit, unsigned int timeout_secs, unsigned maxlen)
void send(const void *data, unsigned length)
std::atomic< bool > exit_signalled
bool readstring(Socket &sck, std::string &s, unsigned int interchar_secs, unsigned length)