This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see NetworkPortsCowan in WG2's repo for R7RS-large.

Network­Ports­Cowan

cowan
2011-08-10 12:23:48
3history
source

Network Ports

Network ports are a mild abstraction of TCP sockets. They are a disjoint type.

In the following descriptions, host and local-address are strings, which may be IPv4 dotted-decimal addresses, IPv6 colon-hexadecimal addresses if supported by the operating system, or host names to be looked up according to whatever operating system conventions exist, if any. Appropriate strings may refer to broadcast or multicast addresses. Port may be an integer or a string; the meaning of a string is implementation-dependent, but is intended to be a standardized service name.

This proposal is not fleshed out, because we don't yet know how to deal with binary vs. character, buffered vs. unbuffered, encoding, line end conventions, etc.

Client Procedures

The procedures in this section take a specification for a TCP socket and return a input/output port connected to the socket.

(open-network-client host port)

Returns an input/output port connected to the remote host and port.

Server Procedures

(make-network-listener [local-address] port)

Returns an opaque listener object (which may be of any type) that will accept connections to the specified port and local-address. If local-address is omitted, the listener will accept connections that are made to port on any local address.

(open-network-server listener)

Waits for a client to connect to listener, and returns an input/output port connected to that client.