Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] parsing and emitting Unix.inet_addr values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] parsing and emitting Unix.inet_addr values
> I'm writing an asynchronous DNS stub resolver, and it irritates me to 
> have to convert 4-octet IPv4 addresses in A records into dot-quad 
> strings, just so I can then call Unix.inet_addr_of_string to get the 
> address into the abstract type.  I'd much rather construct the 
> Unix.inet_addr directly from the four octets, especially since I know 
> that internally they are exactly the same representation.

I understand your irritation about the current interface, and agree
that additional functions over the inet_addr abstract type are needed,
e.g. conversions to and from arrays of integers (each integer
representing one byte of the address).

But: I'm *extremely* wary about interfaces that assume that an inet_addr
is isomorphic to a 32-bit integer or to 4 octets, because these break
horribly with IPv6 addresses.  We've been hearing for so long that
IPv6 is the wave of the future that we might just as well be ready for IPv6.

- Xavier Leroy
Bug reports:  FAQ:
To unsubscribe, mail  Archives: