Next: Socket Options, Previous: Sockets Overview, Up: Networking
Class precedence list:
socket, standard-object, t
Slots:
protocol
— initargs::protocol
Protocol used by the socket. If a keyword, the symbol-name of the keyword will be passed to
get-protocol-by-name
downcased, and the returned value used as protocol. Other values are used as-is.type
— initargs::type
Type of the socket:
:stream
or:datagram
.Common base class of all sockets, not ment to be directly instantiated.
Bind
socket
toaddress
, which may vary according to socket family. For theinet
family, passaddress
andport
as two arguments; forfile
address family sockets, pass the filename string. See also bind(2)
Perform the accept(2) call, returning a newly-created connected socket and the peer address as multiple values
Perform the connect(2) call to connect
socket
to a remotepeer
. No useful return value.
Return the socket's peer; depending on the address family this may return multiple values
Return the address (as vector of bytes) and port that the socket is bound to, as multiple values.
Read
length
octets fromsocket
intobuffer
(or a freshly-consed buffer if NIL), using recvfrom(2). Iflength
isnil
, the length ofbuffer
is used, so at least one of these two arguments must be non-NIL. Ifbuffer
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
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)
Close
socket
. May throw any kind of error that write(2) would have thrown. Ifsocket-make-stream
has been called, callsclose
on that stream instead