hans- IPv4 Network Stack

Safe HaskellNone




sockRemoteHost :: Socket -> IP4 Source

The remote host of a socket.

sockRemotePort :: Socket -> TcpPort Source

The remote port of a socket.

sockLocalPort :: Socket -> TcpPort Source

The local port of a socket.

connect :: TcpHandle -> IP4 -> TcpPort -> Maybe TcpPort -> IO Socket Source

Connect to a remote host.

data ConnectError Source

A connect call failed.



listen :: TcpHandle -> IP4 -> TcpPort -> IO Socket Source

Open a new listening socket that can be used to accept new connections.

accept :: Socket -> IO Socket Source

Accept new incoming connections on a listening socket.

close :: Socket -> IO () Source

Close an open socket.

sendBytes :: Socket -> ByteString -> IO Int64 Source

Send bytes over a socket. The number of bytes delivered will be returned, with 0 representing the other side having closed the connection.

recvBytes :: Socket -> Int64 -> IO ByteString Source

Receive bytes from a socket. A null ByteString represents the other end closing the socket.

canRecv :: Socket -> IO Bool Source

True when there are bytes queued to receive.