Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Peer = Peer {}
- data Message = Message {}
- data IPv4Slab = IPv4Slab {}
- data SocketException :: Type where
- describeEndpoint :: Peer -> String
- freezeIPv4Slab :: IPv4Slab -> Int -> IO (SmallArray Message)
- newIPv4Slab :: Int -> Int -> IO IPv4Slab
Documentation
An peer for an IPv4 socket, connection, or listener. Everything is in host byte order, and the user is not responsible for performing any conversions.
A message received from a peer.
A slab of memory for bulk datagram ingest (via recvmmsg
). This
approach cuts down on allocations. Slabs are not safe for concurrent
access. Do not share a slab across multiple threads.
IPv4Slab | |
|
data SocketException :: Type where Source #
Recoverable exceptions that happen when establishing an internet-domain stream listener or datagram socket.
Discussion
The recoverable exceptions that we encounter with stream sockets (established
with socket
-bind
-listen
) and datagram sockets (established with
socket
-bind
) are the exact same exceptions. Consequently, we reuse
the same type in both case. It is a little unfortunate since the name
ListenException
would be more appropriate for stream sockets. But
the code reuse is worth the naming quibble.
SocketPermissionDenied :: SocketException | The address is protected, and the user is not the superuser. This most
commonly happens when trying to bind to a port below 1024. On Linux,
When it is necessary to bind to such a port on Linux, consider using the
CAP_NET_BIND_SERVICE
capability instead of running the process as root. ( |
SocketAddressInUse :: SocketException | The given address is already in use. ( |
SocketEphemeralPortsExhausted :: SocketException | The port number was specified as zero, but upon attempting to
bind to an ephemeral port, it was determined that all port numbers
numbers in the ephemeral port range are currently in use.
( |
SocketFileDescriptorLimit :: SocketException | A limit on the number of open file descriptors has been reached.
This could be the per-process limit or the system limit.
( |
Instances
Show SocketException Source # | |
Defined in Socket.IPv4 showsPrec :: Int -> SocketException -> ShowS # show :: SocketException -> String # showList :: [SocketException] -> ShowS # | |
Exception SocketException Source # | |
Defined in Socket.IPv4 |
describeEndpoint :: Peer -> String Source #
:: IPv4Slab | The slab |
-> Int | Number of messages in the slab. |
-> IO (SmallArray Message) |
Freeze the specified number of messages in-place and return them (along with their origin peers). Replaces all of the frozen messages with tombstones so that new buffers can be allocated before the next reception. End users should not need this function.