#1 notes on socket page

Alberto Riva
John Foderaro

I'm not sure if this is the correct way to give
feedback. The home page mentions sending mail but then
doesn't provide any email addresses.

I hope this formats ok... here goes:

notes on


A socket is a two-way, reliable communication
stream between
two processes, usually (but not necessarily)
running on
different computers.

I don't know if 'port' supports these but another
important kind
of socket is the UDP socket which does not offer
'reliable' communcation.
You mention other kinds of sockets exist but you shouldn't
imply that all sockets offer reliable communcation.
UDP sockets are important if you want to talk to a DNS

A socket connection originates from a port on a
client machine,
and reaches another port on a server machine.

you're describing sockets in Internet address family.
Unix implementations
offer a Unix address family where sockets are named by
These are important if you're communicating with local
on your Unix machine.


Each hostname is associated with a unique IP address,
represented by four bytes.

you even mention below that this isn't true, that DNS
maps a hostname
to zero or more IP addresses.

Ports are represented as integer numbers in the
range 0-65535

Actually 1-65535. Port 0 can't be allocated.

There are two ways that things could go wrong at
this stage:
either your process does not have sufficient
privileges to
open the desired port (for example, you are
trying to open a
port below 1024 without being root under unix),
or the port you
have chosen has already been opened by another
In both cases, Lisp will signal an error.

another common problem, especially when debugging, is
that you closed
a socket at that address less than 30 seconds ago and
are trying
to open a new socket at that address. The operating system
imposes a delay on reopening a socket at the same
address as
a previous socket. You can turn off this delay by
that you want the address to be reuseable. [I don't
know how
this is done in Port]

* The specified port was not opened on the remote
machine. In this case OPEN-SOCKET returns immediately
with a "connection refused" error.
* The destination port was opened but the server
process did not call SOCKET-ACCEPT. In this case the
connection will be established, but no one will be
listening at the other end. This should never happen
when connecting to properly written servers.
* The destination port is open and the server
process is listening. In this case the connection is
established, and OPEN-SOCKET returns a "socket-stream"

This is a bit confused. The client can't tell if the
the server
is blocked waiting on a call to socket-accept, and
really doesn't care.
The operating system on the server machine accepts and
the connection as long as there is space in the backlog
queue for that socket.
When the server program gets around to calling
the call returns immediately if there is a connection
on the backlog queue, otherwise socket-accept blocks.
Thus the server program need not worry that if a connection
comes in it will be lost if the server is off doing
housekeeping work and not
sitting in a call to socket-accept.


  • Edi Weitz
    Edi Weitz

    • assigned_to: nobody --> albertoriva
  • Alberto Riva
    Alberto Riva

    • status: open --> closed-fixed