The listening socket is always bound to the local network address (how
could it be otherwise?) so I assume you mean that you only want to
listen for connections coming from a specific host. If that is
correct, you can simply accept connections from anywhere and check the
remote address of the socket after accepting it. E.g., something like:
myAddress := #(127 0 0 1) asByteArray.
listener := Socket newTCP.
listener listenOn: myPort backlogSize: 4.
serverSocket := listener waitForAcceptFor: 100.
serverSocket remoteAddress = myAddress
ifFalse:[serverSocket destroy].
should work.
Cheers,
- Andreas
> -----Original Message-----
> From: squeak-dev-bounces_at_lists.squeakfoundation.org
> [mailto:squeak-dev-bounces_at_lists.squeakfoundation.org] On
> Behalf Of Markus Fritsche
> Sent: Sunday, August 31, 2003 9:48 PM
> To: squeak-dev_at_lists.squeakfoundation.org
> Subject: How to bind a listening socket to an address?
>
>
> Hi!
>
> As the subject says, I'd like to know how I could cause a socket to
> listen only on a specific adress, say 127.0.0.1?
>
> Regards, Markus
>
> --
> http://reauktion.de/archer/
>