Connection-oriented networking
Networking

Prev:Address specifiers
Next:Packet-oriented networking


Network connections can be established with this word:
<client> ( remote encoding -- stream local )

with-client ( remote encoding quot -- )

spawn-client ( remote encoding quot -- )


The local address of a client socket can be controlled with this word:
with-local-address ( addr quot -- )


Connection-oriented network servers are implemented by first opening a server socket, then waiting for connections:
<server> ( addrspec encoding -- server )

accept ( server -- client remote )


Server sockets are closed by calling dispose.

Address specifiers have the following interpretation with connection-oriented networking words:
local - Unix domain stream sockets on Unix systems
inet - a TCP/IP connection to a host name/port number pair which can resolve to an IPv4 or IPv6 address
inet4 - a TCP/IP connection to an IPv4 address and port number; no name lookup is performed
inet6 - a TCP/IP connection to an IPv6 address and port number; no name lookup is performed

The io.servers library defines high-level wrappers around <server> which makes it easy to listen for IPv4, IPv6 and secure socket connections simultaneously, perform logging, and optionally only allow connections from the loopback interface.

The io.sockets.secure vocabulary implements secure, encrypted sockets via SSL and TLS.