Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Socket :: Connectedness -> Family -> Type where
- data SendException :: Interruptibility -> Type where
- data ReceiveException :: Interruptibility -> Type where
- data SocketException :: Type where
Documentation
newtype Socket :: Connectedness -> Family -> Type where Source #
A datagram socket. The Connectedness
refers to whether or
not POSIX connect
has been applied to the socket. A connected
socket socket uses POSIX send
/recv
to communicate with a
single peer. An unconnected socket uses POSIX sendto
/recvfrom
to communicate with many peers. The Family
refers to whether this
socket uses IPv4, IPv6, or Unix (local).
Instances
Eq (Socket a b) Source # | |
Ord (Socket a b) Source # | |
Show (Socket a b) Source # | |
data SendException :: Interruptibility -> Type where Source #
SendTruncated :: !Int -> SendException i | The datagram did not fit in the buffer. The field is the number of bytes that were successfully copied into the send buffer. The datagram does still get sent when this happens. |
SendBroadcasted :: SendException i | Attempted to send to a broadcast address. |
SendInterrupted :: SendException Interruptible | STM-style interrupt (much safer than C-style interrupt) |
Instances
Eq (SendException i) Source # | |
Defined in Socket.Datagram (==) :: SendException i -> SendException i -> Bool # (/=) :: SendException i -> SendException i -> Bool # | |
Show (SendException i) Source # | |
Defined in Socket.Datagram showsPrec :: Int -> SendException i -> ShowS # show :: SendException i -> String # showList :: [SendException i] -> ShowS # | |
Typeable i => Exception (SendException i) Source # | |
Defined in Socket.Datagram toException :: SendException i -> SomeException # fromException :: SomeException -> Maybe (SendException i) # displayException :: SendException i -> String # |
data ReceiveException :: Interruptibility -> Type where Source #
ReceiveTruncated :: !Int -> ReceiveException i | The datagram did not fit in the buffer. The field is the original size of the datagram that was truncated. If this happens, the process probably needs to start using a larger receive buffer. |
ReceiveInterrupted :: ReceiveException Interruptible | STM-style interrupt (much safer than C-style interrupt) |
Instances
Eq (ReceiveException i) Source # | |
Defined in Socket.Datagram (==) :: ReceiveException i -> ReceiveException i -> Bool # (/=) :: ReceiveException i -> ReceiveException i -> Bool # | |
Show (ReceiveException i) Source # | |
Defined in Socket.Datagram showsPrec :: Int -> ReceiveException i -> ShowS # show :: ReceiveException i -> String # showList :: [ReceiveException i] -> ShowS # | |
Typeable i => Exception (ReceiveException i) Source # | |
Defined in Socket.Datagram toException :: ReceiveException i -> SomeException # fromException :: SomeException -> Maybe (ReceiveException i) # displayException :: ReceiveException i -> String # |
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 |