Idris2Doc : Network.Socket

Network.Socket

accept : HasIOio => Socket -> io (EitherSocketError (Socket, SocketAddress))
Accept a connection on the provided socket.

Returns on failure a `SocketError`
Returns on success a pairing of:
+ `Socket` :: The socket representing the connection.
+ `SocketAddress` :: The

@sock The socket used to establish connection.
bind : HasIOio => Socket -> MaybeSocketAddress -> Port -> io Int
Binds a socket to the given socket address and port.
Returns 0 on success, an error code otherwise.
close : HasIOio => Socket -> ioUnit
Close a socket
connect : HasIOio => Socket -> SocketAddress -> Port -> ioResultCode
Connects to a given address and port.
Returns 0 on success, and an error number on error.
listen : HasIOio => Socket -> io Int
Listens on a bound socket.

@sock The socket to listen on.
recv : HasIOio => Socket -> ByteLength -> io (EitherSocketError (String, ResultCode))
Receive data on the specified socket.

Returns on failure a `SocketError`
Returns on success a pairing of:
+ `String` :: The payload.
+ `ResultCode` :: The result of the underlying function.

@sock The socket on which to receive the message.
@len How much of the data to receive.
recvAll : HasIOio => Socket -> io (EitherSocketError String)
Receive all the remaining data on the specified socket.

Returns on failure a `SocketError`
Returns on success the payload `String`

@sock The socket on which to receive the message.
recvFrom : HasIOio => Socket -> ByteLength -> io (EitherSocketError (UDPAddrInfo, (String, ResultCode)))
Receive a message.

Returns on failure a `SocketError`.
Returns on success a triple of
+ `UDPAddrInfo` :: The address of the sender.
+ `String` :: The payload.
+ `Int` :: Result value from underlying function.

@sock The channel on which to receive.
@len Size of the expected message.

send : HasIOio => Socket -> String -> io (EitherSocketErrorResultCode)
Send data on the specified socket.

Returns on failure a `SocketError`.
Returns on success the `ResultCode`.

@sock The socket on which to send the message.
@msg The data to send.
sendTo : HasIOio => Socket -> SocketAddress -> Port -> String -> io (EitherSocketErrorByteLength)
Send a message.

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.
@msg The message to send.
socket : HasIOio => SocketFamily -> SocketType -> ProtocolNumber -> io (EitherSocketErrorSocket)
Creates a UNIX socket with the given family, socket type and protocol
number. Returns either a socket or an error.