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.
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.
(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.