Problem with sockets listening with ip address of 0.0.0.0

Bob Arning arning at charm.net
Sun Feb 24 11:12:10 UTC 2002


On Sun, 24 Feb 2002 02:17:51 -0000 "Bill at GLO Ltd" <bill at gloltd.com> wrote:
>If I do
>
>"Socket initializeNetwork.
>(Socket newTCP) listenOn: 5678."
>
>In a workspace I get a socket listening on 5678 with a local ip of 0.0.0.0
>   but
>"NetNameResolver localHostAddress"  gives  ByteArray(192 168 0 1).
>
>Is there anyway to explicitly say what the ip should be when you create a
>socket?

Are you looking at this before or after the socket is connected? If before, then 0.0.0.0 is simply what you get. If after, then you should see whatever the OS says your end of the connection is.

localAddress
	self waitForConnectionUntil: Socket standardDeadline.
	self isConnected ifFalse: [^ByteArray new: 4].	<<----you get zeros here
	^ self primSocketLocalAddress: socketHandle

Cheers,
Bob



More information about the Squeak-dev mailing list