[Haskell] What's with Network.Socket?

Rich Neswold rich.neswold at gmail.com
Tue Apr 10 12:38:03 EDT 2007


On 4/7/07, ROBERT DOUGLAS HOELZ <hoelz at wisc.edu> wrote:
> Is Network.Socket buggy/incomplete?  I'm trying to implement an NNTP module in Haskell, but it seems the Network.Socket module doesn't convert the native byte order to network byte order, so the connection gets denied.  When I reverse the bytes in the address by hand and try to connect, it locks up.  What's wrong?

There was a discussion on it:
http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg11292.html

One answer (use Network.Socket.inet_addr) works, but isn't very
satisfactory. Another recommendation pulls the htons(), et al.
functions into Haskell using FFI. This is better, but more initial
work.

But I believe both answers aren't correct. The binary serialization
module should replace 99% of the need of htonl(), etc. For socket
addresses, the Network library needs to do the endianness conversion,
like the PortNum type does.

-- 
Rich

AIM : rnezzy
ICQ : 174908475
Jabber: rich at neswold.homeunix.net


More information about the Haskell mailing list