#2391 Network.listenOn (PortNumber n) Sometimes Picks IPv6

Aaron Denney wnoise at ofb.net
Mon Jul 21 08:54:33 EDT 2008


On 2008-07-21, Curt Sampson <cjs at starling-software.com> wrote:
> On 2008-07-21 10:09 +0000 (Mon), Aaron Denney wrote:
>> Basically, my position is that listenOn is the wrong interface -- it
>> should take the host addresses as well as the port.
>
> Well, perhaps the idea there was that if you wanted to start doing this,
> you should be using Network.Socket instead of Network, anyway.

Sounds reasonable to me -- my prefered solution would be to deprecate
listenOn.  But I don't have code using it.  OTOH, the stability is
"provisional".  I think there is room for an easier to use interface
than the full Network.Socket, but I don't think listenOn is it.  Perhaps
more like a parameterizable skeleton server?

>> The ports are the same namespace -- it shouldn't matter (much) whether
>> TCP is running over IPv4 or IPv6.
>
> If you bind by hostname (e.g., "localhost") they have separate
> namespaces. I suppose you could take only addresses, but then you need
> some way to construct them, and before you know it you're starting to
> get as complex as Network.Socket.

The same port will of course be connected differently on different
machines.  I think we're quibling over the meaning of namespace here,
but e.g. port 22 is for ssh on both IPv4 and IPv6.

> I think at this point I'm preferring the simple thing: just go for
> PortNumber Int and PortNumber6 Int data constructors, and if you want to
> do better than that, use Network.Socket.

And do we also have both Service and Service6 constructors?  The same
exact issue arises.

-- 
Aaron Denney
-><-



More information about the Libraries mailing list