Receive data (up to @size bytes) from a socket. This is mainly used by
connection-oriented sockets; it is identical to g_socket_receive_from()
with @address set to %NULL.
For %G_SOCKET_TYPE_DATAGRAM and %G_SOCKET_TYPE_SEQPACKET sockets,
g_socket_receive() will always read either 0 or 1 complete messages from
the socket. If the received message is too large to fit in @buffer, then
the data beyond @size bytes will be discarded, without any explicit
indication that this has occurred.
For %G_SOCKET_TYPE_STREAM sockets, g_socket_receive() can return any
number of bytes, up to @size. If more than @size bytes have been
received, the additional data will be returned in future calls to
g_socket_receive().
If the socket is in blocking mode the call will block until there
is some data to receive, the connection is closed, or there is an
error. If there is no data available and the socket is in
non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be
returned. To be notified when data is available, wait for the
%G_IO_IN condition.
On error -1 is returned and @error is set accordingly.
Receive data (up to @size bytes) from a socket. This is mainly used by connection-oriented sockets; it is identical to g_socket_receive_from() with @address set to %NULL.
For %G_SOCKET_TYPE_DATAGRAM and %G_SOCKET_TYPE_SEQPACKET sockets, g_socket_receive() will always read either 0 or 1 complete messages from the socket. If the received message is too large to fit in @buffer, then the data beyond @size bytes will be discarded, without any explicit indication that this has occurred.
For %G_SOCKET_TYPE_STREAM sockets, g_socket_receive() can return any number of bytes, up to @size. If more than @size bytes have been received, the additional data will be returned in future calls to g_socket_receive().
If the socket is in blocking mode the call will block until there is some data to receive, the connection is closed, or there is an error. If there is no data available and the socket is in non-blocking mode, a %G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when data is available, wait for the %G_IO_IN condition.
On error -1 is returned and @error is set accordingly.