7.6 POSIX sockets

A program can communicate with other computers, or with other processes running in the same computer, via sockets. The sockets are identified by file descriptors.

Procedure: fconnect = (string host, int port) int

This procedure creates a stream socket and connects it to the given host using port port. The established communication is full-duplex, and allows sending and receiving data using transput until it gets closed. On success this procedure yields a file descriptor. On error this procedure yields -1 and errno is set appropriately.