Windows Sockets and Handler - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

James King

I'm curious if there are any devs here who work with Windows and sockets. On my stream I'm working on getting the socket setup going and was playing around with the Handle API from System.IO to get line buffering from the socket but when I go to write to the socket with hPutStrLn it drops the connection and throws the "not a socket" error.

Has anyone seen that before? I'm not familiar with the Windows socket API to begin with so knowing what to look for would be a big help. Cheers!

James King

I discussed this on the slack FP chat and it might be a bug either in network or in GHC's Win APIs. Forget the Handle stuff -- if you take the basic example from the network documentation it behaves differently on Unix-like OSes than on Windows and it seems that it should behave the same.

James King

But it sounds like there's a big overhaul to the Win API's in GHC merged into GHC 8.12 or the release thereafter that will give better native Windows support to GHC, so the bug may disappear there if it's not a library issue.