Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Gregory Collins
On Tue, Oct 18, 2011 at 3:18 AM, Jason Dusek jason.du...@gmail.com wrote: The lazy bridging code, `lazyBridge', blocks (unsurprisingly) and does not allow packets to go back and forth. I think I need explicit selects/waits here to get the back and forth traffic. Maybe there is a some way to

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Ertugrul Soeylemez
Jason Dusek jason.du...@gmail.com wrote: I don't think you want either of the functions you mentioned. What you probably want instead is to do concurrent programming by creating Haskell threads.  A hundred Haskell threads reading from Handles are translated to one or more OS threads

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Ertugrul Soeylemez
Michael Orlitzky mich...@orlitzky.com wrote: I have uploaded a simple concurrent echo server implementation to hpaste [1]. It uses one thread for the stdout logger, one thread for the server, one thread for each client and finally a main thread waiting for you to hit enter to quit the

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Ertugrul Soeylemez e...@ertes.de: A proxy server acts a lot like an echo server.  The difference is that usually before the actual proxying starts you have a negotiation phase, and instead of echoing back to the same socket, you just write it to a different one.  Here is an

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Gregory Collins g...@gregorycollins.net: On Tue, Oct 18, 2011 at 3:18 AM, Jason Dusek jason.du...@gmail.com wrote: The lazy bridging code, `lazyBridge', blocks (unsurprisingly) and does not allow packets to go back and forth. I think I need explicit selects/waits here to get the

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Jason Dusek jason.du...@gmail.com: 2011/10/18 Ertugrul Soeylemez e...@ertes.de: A proxy server acts a lot like an echo server.  The difference is that usually before the actual proxying starts you have a negotiation phase, and instead of echoing back to the same socket, you just

[Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Jason Dusek
I would like to use evented I/O for a proxying application. My present thinking is to fork a thread for each new connection and then to wait for data on either socket in this thread, writing to one or the other socket as needed. There are two API functions I've found for waiting and they each

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Ertugrul Soeylemez
Jason Dusek jason.du...@gmail.com wrote: I would like to use evented I/O for a proxying application. My present thinking is to fork a thread for each new connection and then to wait for data on either socket in this thread, writing to one or the other socket as needed. [...] Ideally, I'd

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Michael Orlitzky
On 10/17/11 04:58, Ertugrul Soeylemez wrote: I have uploaded a simple concurrent echo server implementation to hpaste [1]. It uses one thread for the stdout logger, one thread for the server, one thread for each client and finally a main thread waiting for you to hit enter to quit the

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Jason Dusek
2011/10/17 Ertugrul Soeylemez e...@ertes.de: Jason Dusek jason.du...@gmail.com wrote: I would like to use evented I/O for a proxying application. My present thinking is to fork a thread for each new connection and then to wait for data on either socket in this thread, writing to one or the

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-17 Thread Jason Dusek
2011/10/18 Jason Dusek jason.du...@gmail.com: ...load it in GHC and... s/GHC/GHCi/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe