@@ -238,17 +238,20 @@ sendBufMsg s sa bufsizs cmsgs flags = do
238238#endif
239239 return $ fromIntegral sz
240240
241- -- | Receive data from the socket using recvmsg(2).
241+ -- | Receive data from the socket using recvmsg(2). The supplied
242+ -- buffers are filled in order, with subsequent buffers used only
243+ -- after all the preceding buffers are full. If the message is short
244+ -- enough some of the supplied buffers may remain unused.
242245recvBufMsg :: SocketAddress sa
243246 => Socket -- ^ Socket
244- -> [(Ptr Word8 ,Int )] -- ^ A list of a pair of buffer and its size .
247+ -> [(Ptr Word8 ,Int )] -- ^ A list of (buffer, buffer-length) pairs .
245248 -- If the total length is not large enough,
246249 -- 'MSG_TRUNC' is returned
247250 -> Int -- ^ The buffer size for control messages.
248251 -- If the length is not large enough,
249252 -- 'MSG_CTRUNC' is returned
250253 -> MsgFlag -- ^ Message flags
251- -> IO (sa ,Int ,[Cmsg ],MsgFlag ) -- ^ Source address, received data , control messages and message flags
254+ -> IO (sa ,Int ,[Cmsg ],MsgFlag ) -- ^ Source address, total bytes received , control messages and message flags
252255recvBufMsg s bufsizs clen flags = do
253256 withNewSocketAddress $ \ addrPtr addrSize ->
254257 allocaBytes clen $ \ ctrlPtr ->
0 commit comments