[Haskell-cafe] createProcess interferes with sockets?
Donn Cave
donn at avvanta.com
Tue Apr 23 08:28:20 CEST 2013
quoth Evan Laforge <qdunkan at gmail.com>,
...
> and it still waits for the subprocess to complete. Actually, it looks
> like it's the client's hGetContents, since hGetChar comes back
> immediately. I guess that's understandable, but even hGetLine blocks.
In the version I was looking at, if I change the server's output
{-- IO.hPutStr hdl "response" --} to "response\n", it works. Otherwise
hGetLine will still be polling for the newline that will never come.
> System.IO doesn't seem to have a hRead :: Int -> IO String, I guess
> you have to go down to the POSIX fd level, or read char-by-char.
In the present case I believe we'd be talking about
Network.Socket.ByteString.recv. With a POSIX device like a pipe,
then System.Posix.IO.fdRead.
Donn
More information about the Haskell-Cafe
mailing list