Skip to content

Commit 353d8ef

Browse files
committed
updating doc
1 parent 94436bb commit 353d8ef

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Network/Socket.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ module Network.Socket
143143
,RecvIPv4TTL,RecvIPv4TOS,RecvIPv4PktInfo
144144
,RecvIPv6HopLimit,RecvIPv6TClass,RecvIPv6PktInfo)
145145
, StructLinger (..)
146+
, SocketTimeout (..)
146147
, isSupportedSocketOption
147148
, whenSupported
148149
, getSocketOption

Network/Socket/ByteString/IO.hsc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ sendManyTo s cs addr = do
232232
--
233233
-- For TCP sockets, a zero length return value means the peer has
234234
-- closed its half side of the connection.
235+
--
236+
-- Currently, the 'recv' family is blocked on Windows because a proper
237+
-- IO manager is not implemented. To use with 'System.Timeout.timeout'
238+
-- on Windows, use 'Network.Socket.setSocketOption' with
239+
-- 'Network.Socket.RecvTimeOut' as well.
235240
recv :: Socket -- ^ Connected socket
236241
-> Int -- ^ Maximum number of bytes to receive
237242
-> IO ByteString -- ^ Data received

Network/Socket/Options.hsc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module Network.Socket.Options (
2626
, getSockOpt
2727
, setSockOpt
2828
, StructLinger (..)
29+
, SocketTimeout (..)
2930
) where
3031

3132
import qualified Text.Read as P
@@ -251,14 +252,14 @@ pattern SendLowWater = SockOpt (#const SOL_SOCKET) (#const SO_SNDLOWAT)
251252
#else
252253
pattern SendLowWater = SockOpt (-1) (-1)
253254
#endif
254-
-- | SO_RCVTIMEO: this does not work at this moment.
255+
-- | SO_RCVTIMEO: timeout in microseconds
255256
pattern RecvTimeOut :: SocketOption
256257
#ifdef SO_RCVTIMEO
257258
pattern RecvTimeOut = SockOpt (#const SOL_SOCKET) (#const SO_RCVTIMEO)
258259
#else
259260
pattern RecvTimeOut = SockOpt (-1) (-1)
260261
#endif
261-
-- | SO_SNDTIMEO: this does not work at this moment.
262+
-- | SO_SNDTIMEO: timeout in microseconds
262263
pattern SendTimeOut :: SocketOption
263264
#ifdef SO_SNDTIMEO
264265
pattern SendTimeOut = SockOpt (#const SOL_SOCKET) (#const SO_SNDTIMEO)
@@ -481,6 +482,8 @@ instance Storable StructLinger where
481482
----------------------------------------------------------------
482483

483484
-- | Timeout in microseconds.
485+
-- This will be converted into struct timeval on Unix and
486+
-- DWORD (as milliseconds) on Windows.
484487
newtype SocketTimeout = SocketTimeout Word32 deriving (Eq, Ord, Show)
485488

486489
#if defined(mingw32_HOST_OS)

0 commit comments

Comments
 (0)