Next: , Previous: Sockets Overview, Up: Networking


13.2 General Sockets

— Class: sb-bsd-sockets:socket

Class precedence list: socket, standard-object, t

Slots:

Common base class of all sockets, not ment to be directly instantiated.

— Generic Function: sb-bsd-sockets:socket-bind socket &rest address

Bind socket to address, which may vary according to socket family. For the inet family, pass address and port as two arguments; for file address family sockets, pass the filename string. See also bind(2)

— Generic Function: sb-bsd-sockets:socket-accept socket

Perform the accept(2) call, returning a newly-created connected socket and the peer address as multiple values

— Generic Function: sb-bsd-sockets:socket-connect socket &rest peer

Perform the connect(2) call to connect socket to a remote peer. No useful return value.

— Generic Function: sb-bsd-sockets:socket-peername socket

Return the socket's peer; depending on the address family this may return multiple values

— Generic Function: sb-bsd-sockets:socket-name socket

Return the address (as vector of bytes) and port that the socket is bound to, as multiple values.

— Generic Function: sb-bsd-sockets:socket-receive socket buffer length &key oob peek waitall element-type

Read length octets from socket into buffer (or a freshly-consed buffer if NIL), using recvfrom(2). If length is nil, the length of buffer is used, so at least one of these two arguments must be non-NIL. If buffer is supplied, it had better be of an element type one octet wide. Returns the buffer, its length, and the address of the peer that sent it, as multiple values. On datagram sockets, sets MSG_TRUNC so that the actual packet length is returned even if the buffer was too small

— Generic Function: sb-bsd-sockets:socket-listen socket backlog

Mark socket as willing to accept incoming connections. backlog defines the maximum length that the queue of pending connections may grow to before new connection attempts are refused. See also listen(2)

— Generic Function: sb-bsd-sockets:socket-open-p socket

Return true if socket is open; otherwise, return false.

— Generic Function: sb-bsd-sockets:socket-close socket

Close socket. May throw any kind of error that write(2) would have thrown. If socket-make-stream has been called, calls close on that stream instead

— Generic Function: sb-bsd-sockets:socket-make-stream socket &rest args

Find or create a stream that can be used for io on socket (which must be connected). args are passed onto sb-sys:make-fd-stream.

— Function: sb-bsd-sockets:socket-error where

— Generic Function: sb-bsd-sockets:non-blocking-mode socket

Is socket in non-blocking mode?