[Haskell-cafe] TLS package server interface do not seem to allow for asyncrhonious communication

Gregory Collins greg at gregorycollins.net
Wed Dec 15 11:37:51 CET 2010


On Wed, Dec 15, 2010 at 12:20 AM, Antoine Latter <aslatter at gmail.com> wrote:
> Maybe I'm missing something - but shouldn't the code listening on the
> Handle already be in it's own thread?
>
> The general recipe is:
>
> 1. Bind a socket to port
> 2. Call Network.accept, then take the resultant Handle, call forkIO
> with the TLS actions and the resultant handle. Go back to 1.

Yes, for 99% of users this is the right thing to do. Note that Haskell
threads are lightweight green threads and that under the hood you are
getting efficient async networking using epoll() or kqueue() on
Linux/OSX.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list