Herbert said <<
no, you haven't. I used the code in a network with fixed IP's and no DHCP running. Right here using NetNameResolver works just fine. If you doIt:
(NetNameResolver addressForName: 'aComputersName') inspect
you should get an Inspector on a ByteArray with the IP address.
Hmmm, I was expecting to get an inspector on a ByteArray, but what I actually got was an inspector on SocketAddress. Something is obviously not quite right here! :-)
Hi Andy,
AB> (NetNameResolver addressForName: 'aComputersName') inspect
AB> you should get an Inspector on a ByteArray with the IP address.
AB> Hmmm, I was expecting to get an inspector on a ByteArray, but AB> what I actually got was an inspector on SocketAddress. Something AB> is obviously not quite right here! :-)
again not on your side, I tried in Pharo and they introduced a class SocketAddress.
You have to send that instance the message hostNumber to get the IP-Address as .... oops ... a String. I surely didn't expect that!
What makes it worse, is that my code works though I hand an Array as the IP address to Socket. So my best guess is you go to the Pharo list and ask about the proper way to set up a UDP (or TCP) connection.
I could tell you how to pick the bytes out of SocketAddress but this is Smalltalk after all. There must be a high level way.
Sorry for no better reply,
Herbert
beginners@lists.squeakfoundation.org