instance Show SockAddr

Graham Klyne gk at
Sun Oct 17 05:38:25 EDT 2004

At 11:09 16/10/04 +0200, Tomasz Zielonka wrote:
>On Sat, Oct 16, 2004 at 09:37:02AM +0100, Graham Klyne wrote:
> >
> > It seems to me that using a single integer/bitstring value for internal
> > representation of IP addresses is rather missing a trick.
>But that's just what IP4 address is: 32 bits

Well, on the wire it's 32 bits, but from an application's viewpoint, IMO, 
it's an abstract value that is used to address an endpoint.  From the 
user's PoV, it's (usually) four decimal numbers separated by '.'.

> > My hope for a host address representation would be an abstraction whose
> > internal details are hidden, with functions to convert to/from textual 
> form
> > and wire-form (network byte order), and any other abstract operations that
> > may be required (e.g. subnet testing).  This approach should, for example,
> > make migration to IPv6 relatively painless.
>You can make such abstraction on top of the existing one. I would be
>very sad if I couldn't just use IP4 addresses when I want to.

I guess you have your reasons for saying that, though I can't see what they 
might be.  In all my network programming (*) my goal has been to abstract 
away from this underlying 32-bit-ness as quickly as possible.

My concern for making an abstraction on top of the host-order 32-bit value 
is that some trickery is needed to make the code portable.  I'd like to see 
any host-specific details dealt with as deep as possible in the library 


(*) with one exception: implementing an address translation gateway.  In 
that case, the (on-the-wire) address format was pretty much the primary 
concern of the entire software system, but I regard that as an exceptional 

Graham Klyne
For email:

More information about the Libraries mailing list