Read from socket until a terminator character is encountered. Will never consume bytes past the terminator from the socket.
Declared in <util/sock.h>
[[nodiscard]]
virtual
std::string
RecvUntilTerminator(
uint8_t terminator,
std::chrono::milliseconds timeout,
CThreadInterrupt& interrupt,
size_t max_data) const;
| Name | Thrown on |
|---|---|
std::runtime_error | if the operation cannot be completed. In this case some bytes may have been consumed from the socket. |
The data that has been read, without the terminating character.
The return value should not be discarded.
| Name | Description |
|---|---|
| terminator [in] | Character up to which to read from the socket. |
| timeout [in] | Timeout for the entire operation. |
| interrupt [in] | If this is signaled then the operation is canceled. |
| max_data [in] | The maximum amount of data (in bytes) to receive. If this many bytes are received and there is still no terminator, then this method will throw an exception. |