NovelIO


TCP

Namespace: NovelFS.NovelIO

Provides functions relating to TCP connections

Functions and values

Function or valueDescription
acceptConnection serv f
Signature: serv:TCPServer -> f:(TCPConnectedSocket -> IO<'?7263>) -> IO<'?7263>
Type parameters: '?7263

Accept a connection from the supplied TCP server and handle it with the supplied function

acceptFork serv f
Signature: serv:TCPServer -> f:(TCPConnectedSocket -> IO<'?7265>) -> IO<unit>
Type parameters: '?7265

Accept a connection from the supplied TCP server and handle it with the supplied function on a different thread

closeConnection socket
Signature: socket:TCPConnectedSocket -> IO<unit>

Close a connected socket

connectSocket ip port
Signature: ip:IPAddress -> port:int -> IO<TCPConnectedSocket>

Create a TCP connection to the supplied IP and specified port

createServer ip port
Signature: ip:IPAddress -> port:int -> IO<TCPServer>

Create a TCP server at the specfied IP on the specified port

createServerOnFreePort ip
Signature: ip:IPAddress -> IO<TCPServer>

Create a TCP server at the specfied IP

getServerPort server
Signature: server:TCPServer -> IO<int>

Retrieves the port the server is listening on

socketToBinaryChannel tcpSocket
Signature: tcpSocket:TCPConnectedSocket -> IO<BChannel>

Create a binary channel from a connect socket

socketToTextChannel tcpSocket
Signature: tcpSocket:TCPConnectedSocket -> IO<TChannel>

Create a text channel from a connected socket

Fork me on GitHub