[#Sock-RecvUntilTerminator]
= xref:Sock.adoc[Sock]::RecvUntilTerminator
:relfileprefix: ../
:mrdocs:

Read from socket until a terminator character is encountered&period; Will never consume bytes past the terminator from the socket&period;

== Synopsis

Declared in `&lt;util&sol;sock&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
virtual
std::string
RecvUntilTerminator(
    uint8&lowbar;t terminator,
    std::chrono::milliseconds timeout,
    xref:CThreadInterrupt.adoc[CThreadInterrupt]& interrupt,
    size&lowbar;t max&lowbar;data) const;
----

== Exceptions

[cols="1,4"]
|===
| Name| Thrown on
| `std&colon;&colon;runtime&lowbar;error`
| if the operation cannot be completed&period; In this case some bytes may have been consumed from the socket&period;
|===

== Return Value

The data that has been read, without the terminating character&period;

[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&period;
| *timeout* [in]
| Timeout for the entire operation&period;
| *interrupt* [in]
| If this is signaled then the operation is canceled&period;
| *max&lowbar;data* [in]
| The maximum amount of data (in bytes) to receive&period; If this many bytes are received and there is still no terminator, then this method will throw an exception&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
