Simple binary-protocol through network test

Hello, I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back. But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C. This should be rather simple, and I can't get to know why it doesn't work. The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs ----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Yay, I'm glad to see someone else using my package. :-) Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed Operation 1.0 Mult 2.0 into the Client process, and the result it got was 2.0 with the output Just 2.0 on the Server. I got the same results running this on Mac OSX and (Gentoo) Linux, with GHC 10.4. What platform/GHC version are you running it on? Cheers, Greg On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
Hello,
I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back.
But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C.
This should be rather simple, and I can't get to know why it doesn't work.
The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Weird... I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version). Would have I miss something? Like a flush or a close? Logically, I don't see where I would... Gregory Crosswhite-2 wrote:
Yay, I'm glad to see someone else using my package. :-)
Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed
Operation 1.0 Mult 2.0
into the Client process, and the result it got was
2.0
with the output
Just 2.0
on the Server.
I got the same results running this on Mac OSX and (Gentoo) Linux, with GHC 10.4. What platform/GHC version are you running it on?
Cheers, Greg
On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
Hello,
I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back.
But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C.
This should be rather simple, and I can't get to know why it doesn't work.
The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Hmm, I am guessing it is more likely that the problem is that the I/O system changed from 6.10.4 to 6.12.1 somehow in a way that broke the package. You could try turning off all buffering in the handle using hSetBuffering and seeing if that works. Cheers, Greg On Apr 6, 2010, at 3:44 PM, Yves Parès wrote:
Weird...
I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version).
Would have I miss something? Like a flush or a close? Logically, I don't see where I would...
Gregory Crosswhite-2 wrote:
Yay, I'm glad to see someone else using my package. :-)
Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed
Operation 1.0 Mult 2.0
into the Client process, and the result it got was
2.0
with the output
Just 2.0
on the Server.
I got the same results running this on Mac OSX and (Gentoo) Linux, with GHC 10.4. What platform/GHC version are you running it on?
Cheers, Greg
On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
Hello,
I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back.
But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C.
This should be rather simple, and I can't get to know why it doesn't work.
The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Okay, so I turned off every buffering using hSetBuffering hdl NoBuffering on both Client and Server, but I doesn't fix it... BTW, I tried to do the same without your package, i.e. simply through Lazy ByteString and Binary, but it doesn't work either, I come up against the same issue. Gregory Crosswhite-2 wrote:
Hmm, I am guessing it is more likely that the problem is that the I/O system changed from 6.10.4 to 6.12.1 somehow in a way that broke the package. You could try turning off all buffering in the handle using hSetBuffering and seeing if that works.
Cheers, Greg
On Apr 6, 2010, at 3:44 PM, Yves Parès wrote:
Weird...
I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version).
Would have I miss something? Like a flush or a close? Logically, I don't see where I would...
Gregory Crosswhite-2 wrote:
Yay, I'm glad to see someone else using my package. :-)
Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed
Operation 1.0 Mult 2.0
into the Client process, and the result it got was
2.0
with the output
Just 2.0
on the Server.
I got the same results running this on Mac OSX and (Gentoo) Linux, with GHC 10.4. What platform/GHC version are you running it on?
Cheers, Greg
On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
Hello,
I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back.
But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C.
This should be rather simple, and I can't get to know why it doesn't work.
The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

I'm wondering, would it be a problem of chunk size when using L.hGetContents? Since the data to read is shorter than the default chunk size (32k), would it cause problems? Yves Parès wrote:
Okay, so I turned off every buffering using hSetBuffering hdl NoBuffering on both Client and Server, but that doesn't fix it... BTW, I tried to do the same without your package, i.e. simply through Lazy ByteString and Binary, but it doesn't work either, I come up against the same issue.
Gregory Crosswhite-2 wrote:
Hmm, I am guessing it is more likely that the problem is that the I/O system changed from 6.10.4 to 6.12.1 somehow in a way that broke the package. You could try turning off all buffering in the handle using hSetBuffering and seeing if that works.
Cheers, Greg
On Apr 6, 2010, at 3:44 PM, Yves Parès wrote:
Weird...
I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version).
Would have I miss something? Like a flush or a close? Logically, I don't see where I would...
Gregory Crosswhite-2 wrote:
Yay, I'm glad to see someone else using my package. :-)
Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed
Operation 1.0 Mult 2.0
into the Client process, and the result it got was
2.0
with the output
Just 2.0
on the Server.
I got the same results running this on Mac OSX and (Gentoo) Linux, with GHC 10.4. What platform/GHC version are you running it on?
Cheers, Greg
On Apr 6, 2010, at 2:38 PM, Yves Parès wrote:
Hello,
I'm trying to use the packages Network and Control.Monad.BinaryProtocol together, with a very simple program in which a client sends an operation to the server, which computes the result and sends it back.
But the server holds when trying to receive (Server.hs, line 22), whereas the client has actually sent the data (Client.hs, line 17). The server stops to hold only when the client is killed with a Ctrl-C.
This should be rather simple, and I can't get to know why it doesn't work.
The files are here: http://old.nabble.com/file/p28157883/Client.hs Client.hs http://old.nabble.com/file/p28157883/Server.hs Server.hs http://old.nabble.com/file/p28157883/SharedData.hs SharedData.hs
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Am Mittwoch 07 April 2010 19:50:43 schrieb Yves Parès:
I'm wondering, would it be a problem of chunk size when using L.hGetContents? Since the data to read is shorter than the default chunk size (32k), would it cause problems?
That shouldn't cause problems. When less than the default chunk size is available, it makes a chunk of what it got and tries to get more later (unless it found EOF, then it closes the handle).

Yes, from what I read, I assumed it had this behavior. But, then, I don't see why the server holds... I've posted a mail on Haskell-Cafe called "Network: buffering troubles", in which I put a smaller example which reproduces this problem. Daniel Fischer-4 wrote:
That shouldn't cause problems. When less than the default chunk size is available, it makes a chunk of what it got and tries to get more later (unless it found EOF, then it closes the handle).
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
Yes, from what I read, I assumed it had this behavior. But, then, I don't see why the server holds... I've posted a mail on Haskell-Cafe called "Network: buffering troubles", in which I put a smaller example which reproduces this problem.
I know :) I have now tested it, with both (simple) servers and I can't reproduce the problem (ghc-6.12.1 and ghc-6.10.3). 0) compile everything with -O2 (I always do, but for testing purposes I've also compiled the servers without optimisations for the lazy ByteStrings) 1) start server 2) start client 3) server prints Chunk "\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" Empty ("\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" for [Char]-IO) resp. (3,4,5) and exits 4) press return to shut down client Only with strict ByteStrings does the server wait until I shut down the client before printing "\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" and exiting, but that is to be expected, isn't it?
Daniel Fischer-4 wrote:
That shouldn't cause problems. When less than the default chunk size is available, it makes a chunk of what it got and tries to get more later (unless it found EOF, then it closes the handle).
----- Yves Parès
Live long and prosper

Am Mittwoch 07 April 2010 21:53:20 schrieb Daniel Fischer:
Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
Yes, from what I read, I assumed it had this behavior. But, then, I don't see why the server holds... I've posted a mail on Haskell-Cafe called "Network: buffering troubles", in which I put a smaller example which reproduces this problem.
I know :)
I have now tested it, with both (simple) servers and I can't reproduce the problem (ghc-6.12.1 and ghc-6.10.3).
Installed binary-protocol and tried the original (no hSetBuffering), that also works flawlessly (ghc-6.12.1 on openSuSE 11.1). Server: $ ../BeginnersTesting/Server I wait for a client... Result: Just 1.6190478 I wait for a client... Result: Just 12.0 I wait for a client... Result: Nothing ^C Client: $ ./Client localhost Operation? Operation 3.4 Div 2.1 Operation sent. 1.6190478 Operation? Operation 17 Minus 5 Operation sent. 12.0 Operation? Stop Operation sent. Seems to be something with Ubuntu. Maybe somebody else on Ubuntu could test it?

It's amazing! But I'm surprised no one else has this problem, as I assume using network + lazy bytestrings is quite frequent when you want to do network programming in Haskell. BTW, you may not have the same libraries versions as me. Maybe this problems doesn't occur in older versions of bytestring or network. I have the last versions : - network-2.2.1.7 - bytestring-0.9.1.6 (and binary-0.5.0.2, but the simple example showed that the problem came from deeper than it) Daniel Fischer-4 wrote:
Am Mittwoch 07 April 2010 21:53:20 schrieb Daniel Fischer:
Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
Yes, from what I read, I assumed it had this behavior. But, then, I don't see why the server holds... I've posted a mail on Haskell-Cafe called "Network: buffering troubles", in which I put a smaller example which reproduces this problem.
I know :)
I have now tested it, with both (simple) servers and I can't reproduce the problem (ghc-6.12.1 and ghc-6.10.3).
Installed binary-protocol and tried the original (no hSetBuffering), that also works flawlessly (ghc-6.12.1 on openSuSE 11.1).
Server: $ ../BeginnersTesting/Server I wait for a client... Result: Just 1.6190478 I wait for a client... Result: Just 12.0 I wait for a client... Result: Nothing ^C
Client: $ ./Client localhost Operation? Operation 3.4 Div 2.1 Operation sent. 1.6190478 Operation? Operation 17 Minus 5 Operation sent. 12.0 Operation? Stop Operation sent.
Seems to be something with Ubuntu. Maybe somebody else on Ubuntu could test it? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Problem tracked! It comes from the last version of bytestring package. I tried with bytestring-0.9.1.5, and it works perfectly. Do you know where I should submit this bug? ----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Am Donnerstag 08 April 2010 09:17:04 schrieb Yves Parès:
Problem tracked!
It comes from the last version of bytestring package.
Alas, it's maybe not so simple.
I tried with bytestring-0.9.1.5, and it works perfectly.
I just tried with bytestring-0.9.1.6 and it worked perfectly for sending and receiving operations. For the simpler client which just encodes (3,4,5) and sends it to the server, however, the server does nothing until the client exits (then it prints and exits), I suppose that's what you encountered. So the change from hGetContentsN :: Int -> Handle -> IO ByteString hGetContentsN k h = lazyRead -- TODO close on exceptions where lazyRead = unsafeInterleaveIO loop loop = do c <- S.hGetNonBlocking h k to loop = do c <- S.hGet h k seems to be the cause, but for me it doesn't break the first example.
Do you know where I should submit this bug?
Maintainer: dons@galois.com, duncan@haskell.org
----- Yves Parès
Live long and prosper

By the way, Gregory, concerning the package binary-protocol, I was wondering if it was possible to turn the BinaryProtocol monad from type BinaryProtocol = StateT (Handle, Handle, ByteString) IO to: type BinaryProtocol = StateT (Handle, Handle, ByteString) And then the functions, like runProtocol, would become: runProtocol :: (MonadIO m) => BinaryProtocol m a -> Handle -> Handle -> m a I mean that BinaryProtocol could run within any MonadIO, not only IO. This would turn the BinaryProtocol into a monad trans, which would be more generic (we could for instance stack two BinaryProtocols). Yves Parès wrote:
Problem tracked!
It comes from the last version of bytestring package. I tried with bytestring-0.9.1.5, and it works perfectly.
Do you know where I should submit this bug?
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

That sounds like a reasonable modification; if you want, free to fork it at http://github.com/gcross/binary-protocol and push me your proposed changes. Cheers, Greg On Apr 8, 2010, at 9:12 AM, Yves Parès wrote:
By the way, Gregory, concerning the package binary-protocol, I was wondering if it was possible to turn the BinaryProtocol monad from type BinaryProtocol = StateT (Handle, Handle, ByteString) IO to: type BinaryProtocol = StateT (Handle, Handle, ByteString)
And then the functions, like runProtocol, would become: runProtocol :: (MonadIO m) => BinaryProtocol m a -> Handle -> Handle -> m a
I mean that BinaryProtocol could run within any MonadIO, not only IO. This would turn the BinaryProtocol into a monad trans, which would be more generic (we could for instance stack two BinaryProtocols).
Yves Parès wrote:
Problem tracked!
It comes from the last version of bytestring package. I tried with bytestring-0.9.1.5, and it works perfectly.
Do you know where I should submit this bug?
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Okay, Guess I will have to learn how to use git. I used darcs so far... Concerning the bug in bytestring, I sent a mail to dons. I just still have no answer. Gregory Crosswhite-2 wrote:
That sounds like a reasonable modification; if you want, free to fork it at http://github.com/gcross/binary-protocol and push me your proposed changes.
Cheers, Greg
On Apr 8, 2010, at 9:12 AM, Yves Parès wrote:
By the way, Gregory, concerning the package binary-protocol, I was wondering if it was possible to turn the BinaryProtocol monad from type BinaryProtocol = StateT (Handle, Handle, ByteString) IO to: type BinaryProtocol = StateT (Handle, Handle, ByteString)
And then the functions, like runProtocol, would become: runProtocol :: (MonadIO m) => BinaryProtocol m a -> Handle -> Handle -> m a
I mean that BinaryProtocol could run within any MonadIO, not only IO. This would turn the BinaryProtocol into a monad trans, which would be more generic (we could for instance stack two BinaryProtocols).
Yves Parès wrote:
Problem tracked!
It comes from the last version of bytestring package. I tried with bytestring-0.9.1.5, and it works perfectly.
Do you know where I should submit this bug?
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
----- Yves Parès Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

By the way, I happen to have a little problem when I try to add data
compression/decompression.
Since its impossible to add binary treatments (I call binary treatment a
function which type is: ByteString -> ByteString, e.g. compression), I made
my own package binary-communicator. (can be found on hackage)
It's very simple. It's a mere IORef containing a lazy bytestring, and
updated when we try to read from it.
Same example, client sends a computation, the server does it and sends the
result back.
When I use "id" a treatment function (no compression whatsoever), everything
works
But when I use compress/decompress (from Codec.Compression.GZip), I have the
following weird issue:
The server treats well the first computation, and sends back the answer, and
then immediately fails with a "Server: too few bytes. Failed reading at byte
position 1", and closes the connection.
GZip compression is supposed to work on lazy bytestrings, and it does since
the first computation is well done.
Does someone see the problem?
I enclosed an archive containing all the files. (working version of
binary-communicator and the sample)
2010/4/8 Gregory Crosswhite
That sounds like a reasonable modification; if you want, free to fork it at http://github.com/gcross/binary-protocol and push me your proposed changes.
Cheers, Greg
On Apr 8, 2010, at 9:12 AM, Yves Parès wrote:
By the way, Gregory, concerning the package binary-protocol, I was
wondering
if it was possible to turn the BinaryProtocol monad from type BinaryProtocol = StateT (Handle, Handle, ByteString) IO to: type BinaryProtocol = StateT (Handle, Handle, ByteString)
And then the functions, like runProtocol, would become: runProtocol :: (MonadIO m) => BinaryProtocol m a -> Handle -> Handle -> m a
I mean that BinaryProtocol could run within any MonadIO, not only IO. This would turn the BinaryProtocol into a monad trans, which would be more generic (we could for instance stack two BinaryProtocols).
Yves Parès wrote:
Problem tracked!
It comes from the last version of bytestring package. I tried with bytestring-0.9.1.5, and it works perfectly.
Do you know where I should submit this bug?
----- Yves Parès
Live long and prosper -- View this message in context: http://old.nabble.com/Simple-binary-protocol-through-network-test-tp28157883... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Daniel Fischer
-
Gregory Crosswhite
-
Limestraël
-
Yves Parès