Socket.receive

ptrdiff_t receive(scope void[] buf, SocketFlags flags) @trusted

Receive data on the connection. If the socket is blocking, receive waits until there is data to be received.

Returns

The number of bytes actually received, 0 if the remote side

has closed the connection, or Socket.ERROR on failure.

ptrdiff_t receive(scope void[] buf)

ditto