[Haskell-cafe] Socket Programming

Reilly Hayes rfh at reillyhayes.com
Wed Jan 3 14:00:56 EST 2007

Or you could ignore the problem of shutdown altogether:


On Jan 2, 2007, at 12:20 PM, Chris Kuklewicz wrote:

> Mark Goldman wrote:
>> I am trying to write a toy echo server that can handle multiple
>> connections.  I would like to be able to test and see if there are  
>> any
>> connections waiting to be accepted on a socket.  In C and related
>> languages I would use something like select or poll to be nice to the
>> OS, what would I use with the current haskell libs given that I can't
>> seem to find a function to test if accept would block or not?
>> -mdg
> The wiki page http://haskell.org/haskellwiki/Concurrency_demos/ 
> Graceful_exit
> uses accepting connections as its example.
> The main idea is use accept (which blocks) in a background thread  
> and which
> provides the resulting connections to some inter-thread data  
> stream: MVar,
> MChan, TMVar, TChan, or your own structure.
> Shutting down a system is usually subtle, and that wiki page  
> concentrates on a
> trying to create a solution which provides dependable shutdown  
> semantics.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list