Arguments: &rest args&key type format connect address-family eol
Create and returns a socket object with characteristics specified
by the arguments. make-socket checks whether
multiprocessing has been started and starts it if it hasn't been. The
socket object will be an instance of a particular class (see socket for a list of
classes). The class is determined from the values supplied to the
keyword arguments.
The keywords arguments have the following possible values (with the default value given first):
type :streamor:datagramformat All sockets are :multivalent. This argument is ignored.address-family :internetor:fileconnect :activeor:passiveeol kept for backward compatibility only (this argument was used in a much earlier release on WIndows). It should not be specified in new code.
All of the various kinds of sockets are created with make-socket, which determines
the kind of socket you want based on the values of the
type, format,
connect, and address-family
arguments. The value of the address-family
keyword can't be :file on Windows because Windows does
not support it.
make-socket calls a specialized socket creation function and that function looks for other keywords designed just for that socket type. We describe next the extra keywords that are permitted for given values of address-family and type
:address-family :internet :type :stream
These additional keyword arguments are valid:
:local-port,:local-host,:remote-host,:remote-port,:backlog,:reuse-address,:broadcast:keepaliveand:nodelay.The port values are 16-bit integer or strings naming ports found in the operating system's services file and labeled as being
"tcp"services. On Unix the file is called /etc/services. On Windows, it is in the Windows directory and is called services.
:local-hostis usually only specified for:passivesockets. When specified it must be a host name or IP address belonging to one of the network interfaces on the machine on which Lisp is running. By specifying the:local-hostyou can select the network device on which the socket is made. For example if you specify the "127.1" then it restricts this socket to be on the loopback network which means that this socket can only connect to other sockets on the same machine. If:local-hostisn't specified then the operation system will create the socket on the most appropriate network device when a connection is made to it.The host value can be a 32-bit internet address or a string naming a host.
If the
:local-portargument is not given, one will be selected by the system. You can use thelocal-portfunction to determine which port the system selected.Note: The
remote-hostandremote-portvalues aren't used for:passivesockets.The
:backlogvalue is used by:passivesockets to tell the operating system how many connections can be pending (connected but for which anaccept-connectionhasn't been done). The default is 5.
:reuse-addresssets the SO_REUSEADDR flag. This allows a particular port to be reopened in:connect:passivemode even if there is an existing connection for the port. This is very useful when debugging a server program since without it you may have to wait up to a minute after closing a particular port to reopen the same port again (due to certain port-non-reuse requirements found in the TCP/IP protocol).
:broadcastrequests permission to send broadcast packets from this socket. Whether permission is granted depends on the policy of the operating system.
:keepaliveif true then continue to verify that the the connection is alive by sending empty packets to the receiving end.A passive internet address family socket can now be created with a specific
:local-hostvalue. Normally the:local-hostdoesn't need to be specified as the operating system will determine that when a connection is made. There may be times when you want to specify the local-host. For example, a convention has been established that every machine running tcp/ip has at least two IP addresses: one is associated with the ethernet card and one is for a local-to-the-machine network called the loopback network. The loopback IP address is usually 127.1 (it's a Class A address so it is written as two numbers). If you open up a passive socket and specify "127.1" as the local-host, then that means that only programs on your machine can connect to that socket. Naturally, this could very important for security reasons.The
:nodelayadditional keyword argument: normally the network layer will delay sending small packets of data across the network, hoping that if it waits a bit longer there will be more data it can include in the packet. By passing a true value for the:nodelayargument you can turn off this optimization in the network layer.:address-family :file :type :stream
These additional keyword arguments are valid:
:local-filename,:remote-filename, and:backlog.These are the files that name the local and remote filenames for the connection.
For
:passivesockets the :local-filenamemust be specified (and:remote-filenamewill be ignored). For:activesockets:local-filenamecan be omitted but:remote-filenamemust be specified.The filename specified must not already exist in the filesystem (or you'll get an error).
:address-family :internet :type :datagram
These additional keyword arguments are valid:
:local-port,:local-host,:remote-host, and:remote-port,:reuse-address,:broadcast.See the
:internet :streamcase above for the general meaning of the keywords.:reuse-addressand:broadcasthave the same meaning here are described there.
:local-hostmay be specified to select the network device on which the datagram socket is created. Specifying "127.1" for example will put the datagram socket on the loopback network and it will only receive datagrams from other processes on the same machine. If:local-hostis not specified then the datagram socket will be on all network devices simultaneously.A datagram socket is never connected to a remote socket, it can send a message to a different host and port each time data is sent through it. However if you know that you'll be sending data to a particular host and port with this socket, then you can specify that
:remote-hostand:remote-portwhen you create the socket. If you've done that then you can omit the:remote-hostand:remote-portarguments to thesend-tofunction. In other words, specifying the:remote-hostand:remote-portjust sets the default values for the:remote-hostand:remote-portarguments when asend-tois done.:address-family :file :type :datagram
These additional keyword arguments are valid:
:local-filenameand:remote-filename.See the
:file :streamcase above for the meaning of the keywords. As in the description just above, if you specify a:remote-filenamethen you are merely setting the default value for the:remote-filenameargument when asend-tois done.
See socket.htm for general information on sockets in Allegro CL.
The documentation is described in introduction.htm and the index is in index.htm.
Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.
Created 2000.10.5.