Safe Haskell | None |
---|---|
Language | Haskell2010 |
Socket.Datagram.Uninterruptible.MutableBytes
Synopsis
- send :: Socket Connected a -> MutableBytes RealWorld -> IO (Either (SendException Uninterruptible) ())
- sendToIPv4 :: Socket Unconnected (Internet V4) -> Peer -> MutableBytes RealWorld -> IO (Either (SendException Uninterruptible) ())
- receive :: Socket c a -> MutableBytes RealWorld -> IO (Either (ReceiveException Uninterruptible) Int)
- receiveFromIPv4 :: Socket Unconnected (Internet V4) -> MutableBytes RealWorld -> MutablePrimArrayOffset RealWorld SocketAddressInternet -> IO (Either (ReceiveException Uninterruptible) Int)
- receiveMany :: Socket c a -> PeerlessSlab -> IO (Either (ReceiveException Uninterruptible) Int)
- receiveManyFromIPv4 :: Socket Unconnected (Internet V4) -> IPv4Slab -> IO (Either (ReceiveException Uninterruptible) Int)
- data PeerlessSlab = PeerlessSlab {}
- data IPv4Slab = IPv4Slab {}
- newPeerlessSlab :: Int -> Int -> IO PeerlessSlab
- newIPv4Slab :: Int -> Int -> IO IPv4Slab
Send
Arguments
:: Socket Connected a | Socket with designated peer |
-> MutableBytes RealWorld | Slice of a buffer |
-> IO (Either (SendException Uninterruptible) ()) |
Send a datagram using a socket with a pre-designated peer. This
refers to a datagram socket for which POSIX connect
has locked
down communication to an individual peer.
Arguments
:: Socket Unconnected (Internet V4) | IPv4 socket without designated peer |
-> Peer | Destination |
-> MutableBytes RealWorld | Slice of a buffer |
-> IO (Either (SendException Uninterruptible) ()) |
Receive
Arguments
:: Socket c a | Socket |
-> MutableBytes RealWorld | Slice of a buffer |
-> IO (Either (ReceiveException Uninterruptible) Int) |
Receive a datagram, discarding the peer address. This can be used with datagram sockets of any family. It is usable with both connected and unconnected datagram sockets.
Arguments
:: Socket Unconnected (Internet V4) | IPv4 socket without designated peer |
-> MutableBytes RealWorld | Slice of a buffer |
-> MutablePrimArrayOffset RealWorld SocketAddressInternet | Buffer for returned peer address |
-> IO (Either (ReceiveException Uninterruptible) Int) |
Receive Many
Arguments
:: Socket c a | Socket |
-> PeerlessSlab | Buffers into which sizes and payloads are received |
-> IO (Either (ReceiveException Uninterruptible) Int) |
Receive up to the specified number of datagrams into freshly allocated
byte arrays. When there are many datagrams present in the receive
buffer, this is more efficient than calling receive
repeatedly. This
is guaranteed to fill the buffer with at least one message.
The length buffer and the payload buffers arrange data in a
structure-of-arrays fashion. The size of the payload received
into payloads[j]
is stored at lengths[j]
.
Arguments
:: Socket Unconnected (Internet V4) | Socket |
-> IPv4Slab | Buffers into which sizes, addresses, and payloads are received |
-> IO (Either (ReceiveException Uninterruptible) Int) |
Variant of receiveMany
that provides that source address
corresponding to each datagram. This introduces another array
to the structure-of-arrays.
Slabs
Types
data PeerlessSlab #
Constructors
PeerlessSlab | |
Fields |
Constructors
IPv4Slab | |
Fields |
Functions
newPeerlessSlab :: Int -> Int -> IO PeerlessSlab #