Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype SocketFlags = SocketFlags CInt
- dontWait :: MessageFlags m
- truncate :: MessageFlags m
- closeOnExec :: SocketFlags
- nonblocking :: SocketFlags
- applySocketFlags :: SocketFlags -> Type -> Type
Types
newtype SocketFlags Source #
Instances
Message Flags
dontWait :: MessageFlags m Source #
The MSG_DONTWAIT
receive flag or send flag.
truncate :: MessageFlags m Source #
The MSG_TRUNC
receive flag.
Socket Flags
closeOnExec :: SocketFlags Source #
The SOCK_CLOEXEC
receive flag or send flag.
nonblocking :: SocketFlags Source #
The SOCK_NONBLOCK
receive flag or send flag.
Twiddle
applySocketFlags :: SocketFlags -> Type -> Type Source #
Linux extends the type
argument of
socket to accept
flags. It is advisable to set SOCK_CLOEXEC
on when opening a socket
on linux. For example, we may open a TCP Internet socket with:
uninterruptibleSocket internet (applySocketFlags closeOnExec stream) defaultProtocol
To additionally open the socket in nonblocking mode
(e.g. with SOCK_NONBLOCK
):
uninterruptibleSocket internet (applySocketFlags (closeOnExec <> nonblocking) stream) defaultProtocol