Squeak listening to specific IP Addresses?

Peter William Lount peter at ActiveInfo.CA
Tue Jan 20 18:58:32 UTC 2004


Hi,

Thanks for the assistance.

1) Listening to Specific IP Addresses
Socket (and OldSocket) have a method that activates a primitive to listen on
a specific IP Address and Port pair:

OldSocket >>primSocket: aHandle listenOn: portNumber backlogSize: backlog
interface: ifAddr
Socket>>primSocket: aHandle listenOn: portNumber backlogSize: backlog
interface: ifAddr

This seems to enable the listening of connections for "incoming"
conversations providing the ability to run multiple instances of a service
on the same port but with different ip addresses. i.e. 1.2.3.4:80 and
5.6.7.8:80.

Excellent.


2) Connecting From Specific IP Address (and Port)
Socket>>primSocket: socketID connectTo: hostAddress port: port

There doesn't seem to be a way to initiate an "outgoing" connection FROM a
particular IP Address on a multi-homed computer. You can choose the address
and port of the destination for the connection but you can't choose the
from/source ip address (and port). The address likely defaults to the
computer's default address. This is fine when there is one ip address but
when the computer has multiple ip addresses (i.e. multi-homed) it is a
problem, especially when it's important to use particular ip addresses for
particular purposes (i.e. logging, bandwidth tracking, web servers, etc...).

In a full socket protocol you can specify both "source ipaddress:port" and
"destination ipaddress:port" pairs for outgoing connections. I propose that
we extend the Squeak primitives (as follows) to support this full protocol.

"All selection of the outgoing ip address to use. Allow system to choose
outgoing port."
Socket>>
    primSocket: socketID
    connectTo: destinationAddress port: destinationPort
    connectFrom: sourceAddress

Obviously the source address MUST be one of the ip addresses that the local
computer is currently assigned. As such this method really only makes sense
on multi-homed computers. This shouldn't allow "spoofing" of the sending ip
address.

"Allow selection of the outgoing ip address to use. In addition request the
outgoing port to use."
Socket>>
    primSocket: socketID
    connectTo: destinationAddress port: destinationPort
    connectFrom: sourceAddress port: sourcePort

Generally you don't care which outgoing port is used (as it might be in use
already) so the first method is used more often.

Obviously we'd need the non-primitive methods as well.

Does any version of squeak have these or equilivant primitives?

What do you think? I definitely need to have the ability to choose the
outgoing ip address since they are assigned for particular purposes.

All the best,

Peter William Lount, Smalltalk.org Senior Editor
peter at smalltalk.org
peter at activeinfo.ca

p.s. Would it be possible to add my email alias peter at activeinfo.ca to be
accepted by the squeak list? I already receive the list to
peter at smalltalk.org but sometimes I send from the alternate email address.





More information about the Squeak-dev mailing list