[#Sock-Recv] = xref:Sock.adoc[Sock]::Recv :relfileprefix: ../ :mrdocs: recv(2) wrapper. Equivalent to `recv(m_socket, buf, len, flags);`. Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. == Synopsis Declared in `<util/sock.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] virtual ssize_t Recv( void* buf, size_t len, int flags) const; ---- == Return Value Number of bytes received, 0 on orderly shutdown, or ‐1 on error (with errno set). [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *buf* | Destination buffer for the received bytes. | *len* | Maximum number of bytes to receive. | *flags* | Flags passed through to `recv(2)`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#