| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Socket.Eager
Contents
Description
This module exports some basic functions to wait for some given
milliseconds on Sockets to become available for reading or writing.
On top some higher-level functions to connect, send and recv
with timeouts are provided.
The implementation is Unix-only and uses GHC-specific functionality
from GHC.IO.Device and GHC.IO.FD. In particular, the basic wait
functions are just exports of ready.
- data Error
- newtype Milliseconds = Milliseconds {}
- data Descriptor
- descriptor :: Socket -> Descriptor
- connect :: Milliseconds -> SockAddr -> Socket -> IO ()
- connect' :: Milliseconds -> SockAddr -> Descriptor -> IO ()
- send :: Milliseconds -> ByteString -> Socket -> IO ()
- send' :: Milliseconds -> ByteString -> Descriptor -> Socket -> IO ()
- recv :: Milliseconds -> Int -> Socket -> IO ByteString
- recv' :: Milliseconds -> Int -> Descriptor -> Socket -> IO ByteString
- waitRead :: Milliseconds -> Socket -> IO Bool
- waitRead' :: Milliseconds -> Descriptor -> IO Bool
- waitWrite :: Milliseconds -> Socket -> IO Bool
- waitWrite' :: Milliseconds -> Descriptor -> IO Bool
Documentation
Constructors
| ConnectTimeout | |
| RecvTimeout | |
| SendTimeout | |
| ConnectError | |
| ConnectionClosed |
newtype Milliseconds Source
Constructors
| Milliseconds | |
data Descriptor Source
A Descriptor encapsulates an GHC.IO.FD.FD
Most of the wait functions operate on this descriptor which
is implicitly created in functions which only accept a
Socket as parameter.
descriptor :: Socket -> Descriptor Source
connect' :: Milliseconds -> SockAddr -> Descriptor -> IO () Source
send :: Milliseconds -> ByteString -> Socket -> IO () Source
send' :: Milliseconds -> ByteString -> Descriptor -> Socket -> IO () Source
recv :: Milliseconds -> Int -> Socket -> IO ByteString Source
recv' :: Milliseconds -> Int -> Descriptor -> Socket -> IO ByteString Source
basic wait functions
waitRead' :: Milliseconds -> Descriptor -> IO Bool Source
waitWrite' :: Milliseconds -> Descriptor -> IO Bool Source