[squeak-dev] The Inbox: Network-EG.246.mcz

David T. Lewis lewis at mail.msen.com
Sun Jul 25 22:36:37 UTC 2021


On Tue, Jul 20, 2021 at 06:16:51PM +0000, commits at source.squeak.org wrote:
> A new version of Network was added to project The Inbox:
> http://source.squeak.org/inbox/Network-EG.246.mcz
> 
> ==================== Summary ====================
> 
> Name: Network-EG.246
> Author: EG
> Time: 20 July 2021, 2:16:51.031725 pm
> UUID: 286844ab-38ff-4f7d-97a4-37d69eda41e5
> Ancestors: Network-ct.245
> 
> Adding methods and helpers for:
> 1. Converting from an IPv6 string to an IPv6 ByteArray;
> 2. Converting from an IPv6 ByteArray to a valid IPv6 string.
>   
> Note that the complexity here is mostly taken up in dealing with the IPv6
> "feature" of compressing the longest consecutive series of 0 values to
> the string '::'.
>   
> I have also updated the plain #addressFromString: and #stringFromAddress:
> methods to first try and see if they are dealing with what appears to
> be and IPv6 string/bytes and to call the IPv6 specialized versions of
> the method if so.
> 

Interesting work, thanks. Here are some workspace doIts that illustrate
how the raw address bytes related to the socket address information
that is managed in the SocketPlugin in the VM. I used 'google.com' as
an example, because the resolver on my computer gives both an IPv4 and
IPv6 address listing. I am on a 64-bit machine, and the socketAddressBytes
below would be different on a 32-bit machine.

google := NetNameResolver addressesForName: 'google.com'.
googleIPV6 := google second. "==> 2607:f8b0:4009:809::200e(ord37s33-in-x0e.1e100.net),0(0)-inet6-stream-tcp "
socketAddress := googleIPV6 socketAddress. "==> 2607:f8b0:4009:809::200e(ord37s33-in-x0e.1e100.net),0(0) "
socketAddress size. "==> 36 "
socketAddressBytes := ByteArray streamContents: [:strm | strm nextPutAll: socketAddress]. "==> #[245 55 26 98 28 0 0 0 10 0 0 0 0 0 0 0 38 7 248 176 64 9 8 9 0 0 0 0 0 0 32 14 0 0 0 0] "
rs := socketAddressBytes readStream.
networkSessionID := rs next: 8. "==> #[245 55 26 98 28 0 0 0] "
addressSize := rs next: 8. "==> #[10 0 0 0 0 0 0 0] "
rawAddressBytes := rs next: 16. "==> #[38 7 248 176 64 9 8 9 0 0 0 0 0 0 32 14] "
padding := rs next: 4. "==> #[0 0 0 0] "
rs atEnd. "==> true" 
NetNameResolver stringFromIPv6Address: rawAddressBytes. "==> '2607:f8b0:4009:809::200e' "


Dave



More information about the Squeak-dev mailing list