[Haskell-cafe] TCP Server

Jean-Marie Gaillourdet jmg at gaillourdet.net
Sat Jan 28 11:51:32 CET 2012


Hello,

On 27.01.2012, at 00:47, Alexander V Vershilov wrote:
> Recently I asked about tcp server libraries [1] and there was only one
> answer haskell-scallable-server [2], but in that package there was some
> dependencies and server logic that are not good for my task.

A simple search for "server" on Hackage turned up the following packages for somewhat generic server infrastructure:

http://hackage.haskell.org/package/iterio-server
http://hackage.haskell.org/package/generic-server
http://hackage.haskell.org/package/c10k
http://hackage.haskell.org/package/network-server

In issue 19 of The Monad Reader is an article discussing the design of the following web server:
http://hackage.haskell.org/package/mighttpd2

This links might be relevant to your original question. 


> So I decided to make a library with skeletons for different types of 
> tcp servers and a basic library to make server [3]. 
> 
> Now there is only warp based (simplified) tcp server.
> Main logic is:
>  * handle new connection and start iteratee green thread
>  * enumerator (library side) reads socket and send data into enumeratee 
>    (application side)
>  * enumeratee consumes input and produces server command (now simply output)
>    and push it into iteratee (server side)
>  * iteratee server side reads command and performs action (now simply output
>    command)
> It gives application possibility to store state in enumerator.
> 
> My questions to community:
>  1). can you help to make code better ;) maybe there are some stupid mistakes
>  2). is there any ideas what thing can be add to the server to make it reusable

I think there is still no consensus on which iteratee library is the one to use. There are at least iteratee, enumerator, iterIO, conduit, and pipes. The reusability of your libary depends on the choice of iteratee-style library you select. 

Jean




More information about the Haskell-Cafe mailing list