Claus Reinke
Wed, 12 Mar 2003 19:09:35 -0000

Happy with my Winsock work-arounds for my small client-/server-test,
I decided to try integrating the Network use into my target project, and
got nothing but trouble. Again, things that work happily under Unix
simply fail under windows. 

My best guess at the moment is that the socketToHandle conversion 
used within accept and connectTo simply doesn't work as advertised, 
under windows (at least, handle-based operations such as hGetLine
or hClose on the handles returned by accept/connectTo results in errors, 
whereas avoiding the socketToHandle conversion and using 
Network.Socket.send and Network.Socket.recv yields some improvements..).

A little more digging in mail-archives brings up the following rather
discouraging thread/message:

    Socket library ghc 5.02.1

in which Sigbjorn summarizes: 

  FYI, in case you're planning on doing socket programming with GHC-5.02
  on a Win32 platform, stay away from using the higher-level Socket module,
  since its IO.Handle based view of sockets is just broken. Stick with the
  lower-level SocketPrim interface instead.

Is it just me doing something stupid, or is this problem still pertinent, for the
higher-level Network module in GHC-5.04? If the latter, could this please be 
flagged in the GHC documentation, so that people don't have to rediscover
the problem by painful debugging? (if the former, any suggestions on what 
I should try instead?)

Is anyone else here using GHC's Network module under Windows?


FPI: foreign problem interface