Sockets/Sockets.cpp
std::string Socket::recvString(byte terminator)
{
  static const int buflen = 1;
  char buffer[1];
  std::string str;
  while (true)
  {
    iResult = ::recv(socket_, buffer, buflen, 0);
    if (iResult == 0 || iResult == INVALID_SOCKET)
      break;
    if (buffer[0] == terminator)
      break;
    str += buffer[0];
  }
  return str;
}
//----< receives terminator terminated string >------------------------------
/*
 * Doesn't return until a terminator byte as been received.
 *
 * ToDo:
 * - needs reads of one byte to be replaced by bulk reads into a
 *   stream buffer to improve efficiency.
 * - That will require building a circular buffer.
 * - performance seems acceptable, so won't do this now
 */
< receives terminator terminated string >
Doesn't return until a terminator byte as been received.

- needs reads of one byte to be replaced by bulk reads into a
stream buffer to improve efficiency.
- That will require building a circular buffer.
- performance seems acceptable, so won't do this now
< receives terminator terminated string > Doesn ' t return until a terminator byte as been received . - needs reads of one byte to be replaced by bulk reads into a stream buffer to improve efficiency . - That will require building a circular buffer . - performance seems acceptable so won ' t do this now
std::string Socket::recvString(byte terminator)
{
  static const int buflen = 1;
  char buffer[1];
  std::string str;
  while (true)
  {
    iResult = ::recv(socket_, buffer, buflen, 0);
    if (iResult == 0 || iResult == INVALID_SOCKET)
      break;
    if (buffer[0] == terminator)
      break;
    str += buffer[0];
  }
  return str;
}
std :: string Socket :: recvString ( byte terminator ) { static const int buflen = 1 ; char buffer [ 1 ] ; std :: string str ; while ( true ) { iResult = :: recv ( socket_ , buffer , buflen , 0 ) ; if ( iResult == 0 || iResult == INVALID_SOCKET ) break ; if ( buffer [ 0 ] == terminator ) break ; str += buffer [ 0 ] ; } return str ; }
< receives terminator terminated string >
 Doesn't return until a terminator byte as been received.
< receives terminator terminated string > Doesn ' t return until a terminator byte as been received .