network-unexceptional-0.2.1.1: Network functions that do not throw exceptions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Unexceptional

Synopsis

Documentation

accept_ :: Socket -> IO (Either Errno Socket) Source #

Accept a connection. See the documentation in network for accept.

Note: This may leak a file descriptor if an asynchronous exception is received while this function is running.

socket :: Family -> SocketType -> ProtocolNumber -> IO (Either Errno Socket) Source #

Create a socket. See the documentation in network for socket.

There is no interruptible variant of this function because it cannot block. (It does not actually perform network activity.)

connect :: Socket -> SockAddr -> IO (Either Errno ()) Source #

Connect to a socket address. See the documentation in network for connect.

connectInterruptible :: TVar Bool -> Socket -> SockAddr -> IO (Either Errno ()) Source #

Variant of connect that can be interrupted by setting the interrupt variable to True. If interrupted in this way, this function returns EAGAIN. For example, to attempt to connect for no more than 1 second:

interrupt <- Control.Concurrent.STM.registerDelay 1_000_000
connectInterruptible interrupt sock sockAddr