Scieneer Common Lisp 1.3.9 online documentation

Sockets

ext:lookup-host-entry host[Function]

Return a ext:host-entry for the given host if found otherwise return nil and an error number. The host may be an address string or an IP address in host byte order.

ext:host-entry[Class]

Class precedence list:

ext:host-entry, structure-object, ext:instance, t.

Information about an internet host, such as the name and network address.

ext:host-entry-name structure[Function]

Returns the official name for the host or an IPv4 address string.

ext:host-entry-aliases structure[Function]

Returns a list of alternative names for the host.

ext:host-entry-addr-list structure[Function]

Returns a list of networks addresses of the host in host byte order.

ext:host-entry-addr host[Function]

Returns the first network address in host byte order.

ext:htonl x[Function]

Convert the long integer x from host byte order to network byte order.

ext:ntohl x[Function]

Convert the long integer x from network byte order to host byte order.

ext:htons x[Function]

Convert the short integer x from host byte order to network byte order.

ext:ntohs x[Function]

Convert the short integer x from network byte order to host byte order.

ext:create-unix-socket &optional kind[Function]

Create an endpoint for communication in the Unix protocol family. The :kind may be either the default :stream or :datagram. Return a descriptor referencing the socket upon success otherwise an error is signaled.

ext:connect-to-unix-socket path &key kind timeout[Function]

Create a unix protocol socket of the given kind, and connect to the given path. Return a descriptor referencing the socket upon success otherwise an error is signaled. The timeout, if supplied, is the number of seconds to wait before giving up and signaling an error.

ext:create-unix-listener path &optional kind &key backlog[Function]

Create an Unix protocol socket of the given kind, binding it to the given path and initializing it to accept connections. The :kind may be either the default :stream or :datagram. The backlog defines the maximum length of the queue of pending connections. Returns a descriptor referencing the socket, otherwise an error is signaled.

ext:accept-unix-connection unconnected[Function]

Accept a Unix connection on the unconnected socket descriptor. The socket descriptor may be initialized using ext:create-unix-listener. Return the new socket descriptor upon success otherwise an error is signalled.

ext:create-inet-socket &optional kind[Function]

Create an endpoint for communication in the IPv4 protocol family. The :kind may be either the default :stream or :datagram. Return a descriptor referencing the socket upon success otherwise an error is signaled.

ext:connect-to-inet-socket host port &key kind timeout local-host local-port[Function]

Create an endpoint for communication in the IPv4 protocol family, and connect to the given host and port. The host may be an address string or an IP address in host byte order. The :kind may be either the default :stream or :datagram. The timeout, if supplied, is the number of seconds to wait before giving up and signaling an error. The local-host may be an address string or an IP address in host byte order and if supplied the socket is given this host address. The local-port may be an integer and if supplied the socket is given this port. Return a descriptor referencing the socket upon success otherwise an error is signaled.

ext:create-inet-listener port &optional kind &key host reuse-address backlog search[Function]

Create an IPv4 protocol socket of the given kind, binding it to the given host and port and initializing it to accept connections. The :kind may be either the default :stream or :datagram. The host may be a local host number or host name. The backlog defines the maximum length of the queue of pending connections. When reuse-address is true the socket will succeed in binding to the address except if there is already an active listening socket bound to the address. When search is true, search for an available port starting from the given port. Return a descriptor referencing the socket and the successful port number upon success, otherwise an error is signaled.

ext:accept-tcp-connection unconnected[Function]

Accept a TCP connection on the unconnected socket descriptor. The socket descriptor may be initialized using ext:create-inet-listener. Return the new socket descriptor upon success otherwise an error is signalled.

ext:close-socket socket[Function]

Close the given socket, signaling an error upon failure.

ext:get-peer-host-and-port fd[Function]

Return the peer host address and port in host order. Upon failure signal an error.

ext:get-socket-host-and-port fd[Function]

Return the socket fd host address and port in host order. Upon failure signal an error.

sys:make-fd-stream file-descriptor &key input output element-type external-format buffering timeout expiration in-buffer-size out-buffer-size name auto-close file original delete-original close-abort-remove pathname interactive[Function]

Create a stream for the given unix file-descriptor.

:input
If true, allow input operations. This is the default if neither :input or :output is specified.
:output
If true, allow output operations.
:element-type
Indicates the element type to use. Only subtypes of character and '(unsigned-byte 8) types are supported.
:external-format
The external format to use. The default value is :default for which the value of ext:*default-external-format* is used. The external format may be a keyword representing a character set to use for character streams, or a list of formats that convert from the desired character or binary stream to the binary stream read and/or written to the file descriptor. Leading character based formats are ignored for binary streams.
:buffering
Indicates the kind of output buffer flushing to use which may be one of: :none, :line, or the default :full. Line buffering is only applicable to character streams.
:timeout
The number of seconds to wait upon an input or output operation. If false, which is the default, then wait forever. When a timeout occurs the sys:io-timeout condition is signaled.
:expiration
The number of seconds before the stream expires. If false, which is the default, then the stream does not expire. When the stream expires, the sys:io-timeout condition is signaled until the expiration time is reset.
:pathname
The file pathname for a file-stream. This will be returned by pathname and causes a file-stream to be created.
:file
The namestring of the file pathname. This must be supplied whenever the pathname is supplied.
:name
Used to identify the stream when printed.
:auto-close
When true, a finalization is created to ensure the file-descriptor is closed when there are no more references to the returned stream, and the file descriptor will also be closed upon a throw output of this function which can occur upon an error. When true, the caller must not close the file descriptor upon an error because it may already have been closed. When false, it is the responsibility of the caller to close the file descriptor, even upon an error.
:interactive
When t or nil, flag the stream as interactive or non-interactive respectively. When :tty, which is the default, the stream is flagged as interactive if it is associated with a tty device. The state of the stream may be read or written using interactive-stream-p.