Network library: getting host address

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Jun 28 09:38:30 EDT 2005


Is there any good reason why I can get a bound socket's port with
getPortSocket, but cannot get its host address (ie, IP number)?  Sure,
this makes only sense for ip sockets, but there it is sometimes crucial
to get at this information.

I can get the information using the lower-level Network.Socket using

>  SockAddrInet _ hostAddr <- getSocketName socket
>  host <- inet_ntoa hostAddr

but I think that this is the kind of information that needs to be
available in the high-level interface, too.

BTW, shouldn't Network also reexport constants, such as aNY_PORT and
iNADDR_ANY.

Manuel




More information about the Libraries mailing list