Create an instance of a subclass of
socket.address-family,type,connectand IPV6 are used to specify the kind of socket to create.To initialize the socket, the following keyword arguments can be used depending on
address-family-:internetor:local(or:fileas synonim)type-:streamor:datagramconnect-:activeor:passive- IPV6
-ifnil, create an IPv4 socket, otherwise an IPv6 socket.address-family,typeandconnect:Glossary:
- :local-host
-a hostname designator ornil. If non-null the socket will be bound to this address- :local-port
-a port designator ornil. Iflocal-hostis non-null, bind the socket to this port. Ifnil, choose a random port- :remote-host
-a hostname designator ornil. If non-null the socket will be connected to this address- :remote-port
-a port designator. Ifremote-hostis non-null, connect the socket to this port- :local-filename
-a string ornil. If non-null the socket will be bound to this file- :remote-filename
-a string ornil. If non-null the socket will be connected to this file- :backlog
-a positive integer ornil. Specifies the length of the incomming connection queue and can't be larger than+max-backlog-size+. Ifnil, default is*default-backlog-size*- :reuse-address: a boolean(default T). set option SO_REUSEADDR if
local-hostis non-null- :keepalive
-a boolean. set option SO_KEEPALIVE- :nodelay
-a boolean. set option SO_NODELAY- :interface
-a string. set option SO_BINDTODEVICE to this interface- :input-buffer-size
-a positive integer. Create the stream input buffer of this size- :output-buffer-size
-a positive integer. Create the stream output buffer of this size:address-family
- hostname designator: an instance of
inet-addressor any object accepted bylookup-host. IPV6 is passed tolookup-hostas is- port designator: any object accepted by
lookup-service:internet:type:stream:connect:active:address-family
- Valid keyword args:
:local-host,:local-port,:remote-host,:remote-port,:reuse-address,:keepalive,:nodelay,:input-buffer-sizeand:output-buffer-size:internet:type:stream:connect:passive:address-family
- Valid keyword args:
:local-host,:local-port,:backlog,:reuse-address,:interfaceand:nodelay:internet:type:stream:connect:active:address-family
- Valid keyword args:
:local-filename,:remote-filename,:input-buffer-sizeand:output-buffer-size:internet:type:stream:connect:passive:address-family
- Valid keyword args:
:local-filename,:remote-filename,:backlogand:reuse-address:internet:type:datagram:address-family
- Valid keyword args:
:local-host,:local-port,:remote-host,:remote-port,:reuse-address,:interfaceand:broadcast:local:type:datagram
- Valid keyword args:
:local-filenameand:remote-filename
Bind
varto a socket created by passingargstomake-socketand executebodyas implicitprogn. The socket is automatically closed upon exit.
Create a socket instance of the appropriate subclass of
socketusingfd. The connection type of the socket must be specified-:activeor:passive. The address family and type of the socket are automatically discovered usingosfunctions. Buffer sizes for the new socket can also be specified usinginput-buffer-sizeandoutput-buffer-size.
Create a pair of sockets connected to each other. The socket type must be either
:streamor:datagram. Currently OSes can only create:localsockets this way. Buffer sizes for the new sockets can also be specified usinginput-buffer-sizeandoutput-buffer-size.
Send the contents of
buffertosocket.buffermust be a vector that can be coerced to a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).startandendare used a bounding index onbuffer. For disconnected datagram sockets,remote-hostandremote-portorremote-filenameare used as destination for the data.Some flags can also be passed to sendto(2):
Returns the number of bytes sent.
:out-of-bandfor receiving out-of-band data-only for stream sockets:dont-waitfor making only the current call non-blocking:dont-routefor sending only to hosts on directly connected networks, not using gateways:confirmfor signalling progress on the link layer-only available on Linux and only withdatagramsockets:morefor telling the kernel that there is more data to send-only available on Linux
Receives data from
socket. Ifbufferis specifiedstartandendare used as bounding index. In that casebuffermust be an array and itsarray-element-typebe either (UNSIGNED-BYTE 8) ort. Ifbufferis not specified an (UNSIGNED-BYTE 8) buffer of sizesizewill be allocated.Some flags can also be passed to recvfrom(2):
The first two values returned are the buffer and the number of elements that have been copied into the buffer. For
:out-of-bandfor receiving out-of-band data-only forstreamsockets:peekfor keeping the returned data in the kernel buffers:wait-allfor waiting until the entire buffer can be filled:dont-waitfor making only the current call non-blockinginternetdatagramsockets, two additional values are returned: the host and port of the remote peer from which the data was received. Forlocaldatagramsockets, one additional values is returned: the filename of the remote peer from which the data was received.
Sets the local address of
socketto ADDRESS(andportforinternetsockets).reuse-addresssets the SO_REUSEADDR socket option onsocket.
Start allowing incoming connections on
socket.backlogspecifies the maximum length of the queue of pending connections.
Returns one connection from the queue of pending connections on
socket. Ifwaitis true, waits until a connection is received ortimeoutexpires in which case returnsnil. Ifwaitis false and there are no pending connections returnnil.external-formatoptionally specifies the external format of the new socket-the default being that ofsocket. Buffer sizes for the new socket can also be specified usinginput-buffer-sizeandoutput-buffer-size.
Bind
varto a socket created by passingpassive-socketandargstoaccept-connectionand executebodyas implicitprogn. The socket is automatically closed upon exit.
Connects
sockettoaddress. Forinternetsockets you can specify the port to connect to using keyword argumentport. The default value ofportis 0, which usually means letting theoschoose a random port to connect to. Forinternetsockets, ifwaitis true and a connection cannot be established withintimeoutseconds signaliomux:poll-timeout, but it works only with non-blocking sockets.
Disassociates
socketfrom any remote address. Works only ondatagramsockets.
Shut down all or part of a connection. If
readit non-NIL, further receptions are disallowed; ifwriteis non-NIL, further transmissions are disallowed.closemust still be called onsocketin order to releaseosresources.