data RecvStructPtr : Type
- Totality: total
Visibility: public export
Constructor: RSPtr : AnyPtr -> RecvStructPtr
data RecvfromStructPtr : Type
- Totality: total
Visibility: public export
Constructor: RFPtr : AnyPtr -> RecvfromStructPtr
data BufPtr : Type
- Totality: total
Visibility: public export
Constructor: BPtr : AnyPtr -> BufPtr
data SockaddrPtr : Type
- Totality: total
Visibility: public export
Constructor: SAPtr : AnyPtr -> SockaddrPtr
sock_poke : HasIO io => BufPtr -> Int -> Int -> io ()
Put a value in a buffer
Visibility: exportsock_peek : HasIO io => BufPtr -> Int -> io Int
Take a value from a buffer
Visibility: exportsock_free : HasIO io => BufPtr -> io ()
Frees a given pointer
Visibility: exportsockaddr_free : HasIO io => SockaddrPtr -> io ()
- Visibility: export
sock_alloc : HasIO io => ByteLength -> io BufPtr
Allocates an amount of memory given by the ByteLength parameter.
Used to allocate a mutable pointer to be given to the Recv functions.
Visibility: exportgetSockPort : HasIO io => Socket -> io Port
Retrieves the port the given socket is bound to
Visibility: exportgetSockAddr : HasIO io => SockaddrPtr -> io SocketAddress
Retrieves a socket address from a sockaddr pointer
Visibility: exportfreeRecvStruct : HasIO io => RecvStructPtr -> io ()
- Visibility: export
freeRecvfromStruct : HasIO io => RecvfromStructPtr -> io ()
Utility to extract data.
Visibility: exportsendBuf : HasIO io => Socket -> BufPtr -> ByteLength -> io (Either SocketError ResultCode)
Sends the data in a given memory location
Returns on failure a `SocketError`
Returns on success the `ResultCode`
@sock The socket on which to send the message.
@ptr The location containing the data to send.
@len How much of the data to send.
Visibility: exportrecvBuf : HasIO io => Socket -> BufPtr -> ByteLength -> io (Either SocketError ResultCode)
Receive data from a given memory location.
Returns on failure a `SocketError`
Returns on success the `ResultCode`
@sock The socket on which to receive the message.
@ptr The location containing the data to receive.
@len How much of the data to receive.
Visibility: exportsendToBuf : HasIO io => Socket -> SocketAddress -> Port -> BufPtr -> ByteLength -> io (Either SocketError ResultCode)
Send a message stored in some buffer.
Returns on failure a `SocketError`
Returns on success the `ResultCode`
@sock The socket on which to send the message.
@addr Address of the recipient.
@port The port on which to send the message.
@ptr A Pointer to the buffer containing the message.
@len The size of the message.
Visibility: exportforeignGetRecvfromPayload : HasIO io => RecvfromStructPtr -> io String
Utility function to get the payload of the sent message as a `String`.
Visibility: exportforeignGetRecvfromAddr : HasIO io => RecvfromStructPtr -> io SocketAddress
Utility function to return senders socket address.
Visibility: exportforeignGetRecvfromPort : HasIO io => RecvfromStructPtr -> io Port
Utility function to return sender's IPV4 port.
Visibility: exportrecvFromBuf : HasIO io => Socket -> BufPtr -> ByteLength -> io (Either SocketError (UDPAddrInfo, ResultCode))
Receive a message placed on a 'known' buffer.
Returns on failure a `SocketError`.
Returns on success a pair of
+ `UDPAddrInfo` :: The address of the sender.
+ `Int` :: Result value from underlying function.
@sock The channel on which to receive.
@ptr Pointer to the buffer to place the message.
@len Size of the expected message.
Visibility: export