[#Sock-RecvUntilTerminator] = xref:Sock.adoc[Sock]::RecvUntilTerminator :relfileprefix: ../ :mrdocs: Read from socket until a terminator character is encountered. Will never consume bytes past the terminator from the socket. == Synopsis Declared in `<util/sock.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] virtual std::string RecvUntilTerminator( uint8_t terminator, std::chrono::milliseconds timeout, xref:CThreadInterrupt.adoc[CThreadInterrupt]& interrupt, size_t max_data) const; ---- == Exceptions [cols="1,4"] |=== | Name| Thrown on | `std::runtime_error` | if the operation cannot be completed. In this case some bytes may have been consumed from the socket. |=== == Return Value The data that has been read, without the terminating character. [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#