Copyright | (c) 2018 Mihai Giurgeanu |
---|---|
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
- fromUDP :: MonadResource m => String -> PortNumber -> Int -> Stream (Of (ByteString, SockAddr)) m r
- fromSocket :: MonadIO m => Socket -> Int -> Stream (Of (ByteString, SockAddr)) m r
- fromIOSocket :: MonadResource m => IO Socket -> Int -> Stream (Of (ByteString, SockAddr)) m r
- toUDP :: MonadResource m => String -> PortNumber -> Stream (Of (ByteString, SockAddr)) m r -> m r
- toSocket :: MonadIO m => Socket -> Stream (Of (ByteString, SockAddr)) m r -> m r
- toIOSocket :: MonadResource m => IO Socket -> Stream (Of (ByteString, SockAddr)) m r -> m r
- inet_addr :: String -> IO HostAddress
- data SockAddr :: * = SockAddrInet PortNumber HostAddress
Documentation
:: MonadResource m | |
=> String | address to bind to |
-> PortNumber | port number to bind to |
-> Int | maximum size of a datagram |
-> Stream (Of (ByteString, SockAddr)) m r |
Fire-and-forget style UDP source. It will attempt to listen on the specified interface and port, and if it succeeds it can read contents being sent to that interface and port. It streams a pair of (message, source-address) allowing the downstream to know who sent the message.
:: MonadResource m | |
=> IO Socket | the |
-> Int | max length of a datagram |
-> Stream (Of (ByteString, SockAddr)) m r | the resulting stream of messages |
An alternative to fromSocket
. Instead of taking a pre-bound Socket
,
it takes an action that opens and binds a Socket, so that it can open it
only when needed and close it as soon as possible.
toUDP :: MonadResource m => String -> PortNumber -> Stream (Of (ByteString, SockAddr)) m r -> m r Source #
gets an ip adress, a port and stream of strict pairs (ByteString
, SockAddr
) and
sends all the ByteString
s to the SockAddr
from a socet bounded to the give ip and port.
Note: before 0.2.0.0 this function had a different specification.
Since: 0.2.0.0
toIOSocket :: MonadResource m => IO Socket -> Stream (Of (ByteString, SockAddr)) m r -> m r Source #
Reexports
inet_addr :: String -> IO HostAddress #
The existence of a constructor does not necessarily imply that
that socket address type is supported on your system: see
isSupportedSockAddr
.