Safe Haskell | None |
---|---|
Language | Haskell2010 |
Socket.Datagram.IPv4.Unconnected
Contents
Description
Internet datagram sockets without a fixed destination.
Types
newtype Socket (a :: Connectedness) (b :: Family) #
Instances
Eq (Socket a b) | |
Ord (Socket a b) | |
Show (Socket a b) | |
Establish
Arguments
:: Peer | Address and port to use |
-> (Socket Unconnected (Internet V4) -> Word16 -> IO a) | Callback providing the socket and the chosen port |
-> IO (Either SocketException a) |
Open a socket and run the supplied callback on it. This closes the socket
when the callback finishes or when an exception is thrown. Do not return
the socket from the callback. This leads to undefined behavior. If the
address 0.0.0.0
is used, the socket receives on all network interfaces.
If the port 0 is used, an unused port is chosen by the operating system.
The callback provides the chosen port (or if the user specified a non-zero
port, the chosen port will be that value).
Exceptions
data SocketException #
Constructors
SocketPermissionDenied | |
SocketAddressInUse | |
SocketEphemeralPortsExhausted | |
SocketFileDescriptorLimit |
Instances
Show SocketException | |
Defined in Socket.IPv4 Methods showsPrec :: Int -> SocketException -> ShowS # show :: SocketException -> String # showList :: [SocketException] -> ShowS # | |
Exception SocketException | |
Defined in Socket.IPv4 Methods toException :: SocketException -> SomeException # |