recv package:network
Receive data from the socket. The socket must be in a connected state.
This function may return fewer bytes than specified. If the message is
longer than the specified length, it may be discarded depending on the
type of socket. This function may block until a message arrives.
Considering hardware and network realities, the maximum number of
bytes to receive should be a small power of 2, e.g., 4096.
For TCP sockets, a zero length return value means the peer has closed
its half side of the connection.
Currently, the
recv family is blocked on Windows because a
proper IO manager is not implemented. To use with
timeout on
Windows, use
setSocketOption with
RecvTimeOut as well.
Receive data from the socket. The socket must be in a connected state.
This function may return fewer bytes than specified. If the received
data is longer than the specified length, it may be discarded
depending on the type of socket. This function may block until a
message arrives.
If there is no more data to be received, returns an empty
ByteString.
Receive data from the socket. The socket must be in a connected state.
This function may return fewer bytes than specified. If the message is
longer than the specified length, it may be discarded depending on the
type of socket. This function may block until a message arrives.
Considering hardware and network realities, the maximum number of
bytes to receive should be a small power of 2, e.g., 4096.
The return value is the length of received data. Zero means EOF.
Historical note: Version 2.8.x.y or earlier, an EOF error was thrown.
This was changed in version 3.0.
Receive data from the socket, writing it into buffer instead of
creating a new string. The socket need not be in a connected state.
Returns
(nbytes, address) where
nbytes is the number
of bytes received and
address is a
SockAddr
representing the address of the sending socket.
If the first return value is zero, it means EOF.
For
Stream sockets, the second return value would be invalid.
NOTE: blocking on Windows unless you compile with -threaded (see GHC
ticket #1129)
Receive data from the socket using recvmsg(2).
Receive a file descriptor over a UNIX-domain socket. Note that the
resulting file descriptor may have to be put into non-blocking mode in
order to be used safely. See
setNonBlockIfNeeded. This function
does not work on Windows.
Receive data from the socket, writing it into buffer instead of
creating a new string. The socket need not be in a connected state.
Returns
(nbytes, address) where
nbytes is the number
of bytes received and
address is a
SockAddr
representing the address of the sending socket.
If the first return value is zero, it means EOF.
For
Stream sockets, the second return value would be invalid.
NOTE: blocking on Windows unless you compile with -threaded (see GHC
ticket #1129)
Receive data from the socket using recvmsg(2). The supplied buffers
are filled in order, with subsequent buffers used only after all the
preceding buffers are full. If the message is short enough some of the
supplied buffers may remain unused.
Receive data from the socket. The socket need not be in a connected
state. Returns
(bytes, address) where
bytes is a
ByteString representing the data received and
address
is a
SockAddr representing the address of the sending socket.
If the first return value is zero, it means EOF.
Receive data from the socket. The socket need not be in a connected
state. Returns
(bytes, address) where
bytes is a
ByteString representing the data received and
address
is a
SockAddr representing the address of the sending socket.
Receive data from the socket using recvmsg(2).
Receiving IP_PKTINFO (struct in_pktinfo).
Receiving IPv6 hop limit.
Receiving IPV6_PKTINFO (struct in6_pktinfo).
Receiving IPv6 traffic class.
SO_RCVTIMEO: timeout in microseconds. This option is not useful in the
normal case where sockets are non-blocking.