network-enumerator-0.1.2: Enumerators for network sockets

Portabilityportable
Maintainerjmillikin@gmail.com
Safe HaskellSafe-Infered

Network.Socket.Enumerator

Description

 

Synopsis

Documentation

enumSocketSource

Arguments

:: MonadIO m 
=> Integer

Buffer size

-> Socket 
-> Enumerator ByteString m b 

Enumerate binary data from a Socket, using recv. The socket must be connected.

The buffer size should be a small power of 2, such as 4096.

enumSocketFromSource

Arguments

:: MonadIO m 
=> Integer

Buffer size

-> Socket 
-> Enumerator (ByteString, SockAddr) m b 

Enumerate binary data from a Socket, using recvFrom. The socket does not have to be connected. Each chunk of data received will be paired with its address.

enumSocketTimedSource

Arguments

:: MonadIO m 
=> Integer

Buffer size

-> Integer

Timeout, in microseconds

-> Socket 
-> Enumerator ByteString m b 

Enumerate binary data from a Socket, using recv. The socket must be connected.

The buffer size should be a small power of 2, such as 4096.

If any call to recv takes longer than the timeout, enumSocketTimed will throw an error. To add a timeout for the entire session, wrap the call to run in timeout.

Since: 0.1.2

iterSocket :: MonadIO m => Socket -> Iteratee ByteString m ()Source

Write data to a Socket, using sendMany. The socket must be connected.

iterSocketTo :: MonadIO m => Socket -> SockAddr -> Iteratee ByteString m ()Source

Write data to a Socket, using sendManyTo. The socket does not have to be connected.

iterSocketTimedSource

Arguments

:: MonadIO m 
=> Integer

Timeout, in microseconds

-> Socket 
-> Iteratee ByteString m () 

Write data to a Socket, using sendMany. The socket must be connected.

If any call to sendMany takes longer than the timeout, iterSocketTimed will throw an error. To add a timeout for the entire session, wrap the call to run in timeout.

Since: 0.1.2