[squeak-dev] IPv6-compatible addresses and sockets (was: Socket code from EToys)

Bert Freudenberg bert at freudenbergs.de
Thu May 19 09:42:27 UTC 2011


On 19.05.2011, at 00:31, Levente Uzonyi wrote:

> On Thu, 19 May 2011, Bert Freudenberg wrote:
> 
>> What result do you get using the Etoys image? It uses the new SocketPlugin primitives (including IPv6 support), which if I see correctly have not been incorporated into Trunk yet.
> 
> It's not in the Trunk yet. I extracted and converted the code, it's in the Inbox now, Network-ul.100.mcz. I didn't push it to the Trunk, because
> 1) Cog doesn't support the new primitives and the fallback code has to be tested thoroughly.

True. But maybe the new SocketPlugin would just work with Cog if somebody tried?

> 2) I don't really like SocketAddress, because IIRC it's like CompiledMethod, in the sense that it's a ByteArray, but it's storing
> pointers/words.

No, it does not store pointers. It's just a platform-dependent chunk of memory. See "man getnameinfo". POSIX requires to use that function to get fields out of the "sockaddr" struct.

> 3) SocketAddress lacks setter methods, so implementing compatibility methods, like ByteArray >> #asSocketAddress is a PITA.

It's platform-dependent. You need to call the primitives to create proper SocketAddresses. That is encapsulated in the class SocketAddressInformation. See e.g. forHost:service:flags:addressFamily:socketType:protocol:.

Btw, there is a method ByteArray>>#asSocketAddress. There are only two senders, it is only used when useOldNetwork is true. Not sure why this needs to be there. We could ask Michael what the idea was. I guess we could get rid of it.

- Bert -





More information about the Squeak-dev mailing list