chickadee » socket » sockaddr-port

sockaddrrecord
sockaddr? saprocedure
sockaddr-family saprocedure
sockaddr-address saprocedure
sockaddr-port saprocedure
sockaddr-path saprocedure
sockaddr->string saprocedure

The socket address object. sockaddr is used throughout the BSD sockets API to represent the address of a local or remote socket endpoint.

The most convenient constructor for Internet socket addresses is inet-address. The fundamental Internet socket address constructor is address-information, which is more powerful but also more complex to use. For UNIX sockets, use unix-address.

Socket address object accessors are:

sockaddr-family
returns the socket address family as an integer constant, e.g. af/inet.
sockaddr-address
returns the address of a socket as a string (for Internet sockets, this is the IP address).
sockaddr-port
returns the socket port for Internet sockets; it is an error to call it on another type of socket.
sockaddr-path
returns the pathname for UNIX sockets, or an error for other socket types.
sockaddr->string
returns a compact representation of the socket address as a string. For Internet sockets, it returns "address" when port is 0; otherwise, it returns "address:port" for IPv4 addresses and "[address]:port" for IPv6 addresses.