sockets-0.4.0.0: High-level network sockets

Safe HaskellNone
LanguageHaskell2010

Socket.Datagram.Interruptible.MutableBytes

Contents

Synopsis

Send

send Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left SendInterrupted.

-> Socket Connected a

Socket with designated peer

-> MutableBytes RealWorld

Slice of a buffer

-> IO (Either (SendException Interruptible) ()) 

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.

sendToIPv4 Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left SendInterrupted.

-> Socket Unconnected (Internet V4)

IPv4 socket without designated peer

-> Peer

Destination

-> MutableBytes RealWorld

Slice of a buffer

-> IO (Either (SendException Interruptible) ()) 

Receive

receive Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left ReceiveInterrupted.

-> Socket c a

Socket

-> MutableBytes RealWorld

Slice of a buffer

-> IO (Either (ReceiveException Interruptible) 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.

receiveFromIPv4 Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left ReceiveInterrupted.

-> 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 Interruptible) Int) 

Receive Many

receiveMany Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left ReceiveInterrupted.

-> Socket c a

Socket

-> PeerlessSlab

Buffers into which sizes and payloads are received

-> IO (Either (ReceiveException Interruptible) 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].

receiveManyFromIPv4 Source #

Arguments

:: TVar Bool

Interrupt. On True, give up and return Left ReceiveInterrupted.

-> Socket Unconnected (Internet V4)

Socket

-> IPv4Slab

Buffers into which sizes, addresses, and payloads are received

-> IO (Either (ReceiveException Interruptible) Int) 

Variant of receiveMany that provides that source address corresponding to each datagram. This introduces another array to the structure-of-arrays.