Subject: [clisp-list] Re: binding sockets

From: [email-masked] (Don Cohen)
Date: Tue Oct 28 22:13:17 2003

> >  (SOCKET:SOCKET-SERVER-HOST socket-server)
 > >  (SOCKET:SOCKET-SERVER-PORT socket-server)
 > >
 > >       Returns the host mask indicating which hosts can connect to this
 > >  server and the port which was bound using SOCKET:SOCKET-SERVER. 
 > >
 > > Is that correct?  I thought this was the local ip address, not remote.
 > 
 > it's a mask for remote hosts.
 > see stream.d:SOCKET-SERVER and socket.d:create_server_socket.

The comments there seem to suggest that this is related to remote
hosts, but what I see in man (wandering through ip(7), bind(2),
packet(7), socket) leads me to believe, as I thought before, that it's
the local address.
This also says, if I read it correctly, that there's nothing between
0.0.0.0 and a single address, i.e., no /24's.

So what I'd like is an optional IP address.  My understanding is that
on a machine with multiple IP addresses you can listen on one or on
all.  Sometimes you want one and sometimes the other.
So far I don't see how to do that with the optional socket argument,
since that could only have been created the same way, giving an IP
address of 0.0.0.0, right?

 > the argument to SOCKET-SERVER can be an existing SOCKET-STREAM, in
 > which case the peer address of that SOCKET-STREAM will be the only
 > address from which this SOCKET-SERVER can accept connections.

This seems to suggest (again) that the address is the remote IP.
I think it's the address of the LOCAL machine.
If I have two IP addresses I want to use ONE of them for this socket
so I can still use the other for another one on the same port, for
instance if I want to run two different web servers with my two
different IP addresses.

 > I am not sure about the reasons for this dichotomy (either port or mask
 > but not both; either mask 0.0.0.0 or a single IP).

The man pages suggest 0.0.0.0 is not a mask but a special case
address.