Network endpoints are a disjoint type representing a network host name or address plus a port.
In the following descriptions, host can be:
Note that appropriate values may refer to broadcast or multicast addresses.
Port can be a positive exact integer or a string. The meaning of a string is implementation-dependent, but is intended to be a standardized service name.
(make-network-endpoint [host] [port])
Returns a newly allocated network endpoint. If port is omitted or 0, then it is an error unless host refers to the local host, and the endpoint specifies an unused port to be assigned by the operating system. If port is present but local-address is omitted or has the value #t, the endpoint specifies the given port on the local host accessed by any address. Otherwise, the endpoint specifies a particular host and port. If there is just one argument, it is port, as this is the more common case.
(network-endpoint? obj)
Returns #t if obj is a network endpoint and #f otherwise.
(network-endpoint-bytevector-address endpoint)
Returns the host specified by endpoint in bytevector format. The value returned need not be the same as the value passed to make-network-endpoint, but must be acceptable to another invocation of make-network-endpoint. If the host was specified as #t, returns #t.
(network-endpoint-string-address endpoint)
Returns the host specified by endpoint in dotted-decimal or dotted-hexadecimal format. The value returned need not be the same as the value passed to make-network-endpoint, but must be acceptable to another invocation of make-network-endpoint. If the host was specified as #t, returns #t.
(network-endpoint-host endpoint)
Returns the host specified by endpoint as a host name, or if the host name is not known or does not exist, in dotted-decimal or dotted-hexadecimal format. The value returned need not be the same as the value passed to make-network-endpoint, but must be acceptable to another invocation of make-network-endpoint. If the host was specified as #t, returns #t.
(network-endpoint-port endpoint)
Returns the port number specified by endpoint as a number. The value returned need not be the same as the value passed to make-network-endpoint, but must be acceptable to another invocation of make-network-endpoint.