lecture
Volker Stolz
stolz@i2.informatik.rwth-aachen.de
Mon, 2 Jun 2003 13:20:08 +0200
In local.haskell, you wrote:
> I am student of Computer Science and I have to write a lecture on ghc
> network module. Where can I get some code samples of this module. I am
> looking for short progrmas that show how to use network module.
There's nothing special about Haskell's/GHC's networking module. As a
rule of thumb you should be able to translate any regular C program
into Haskell. There isn't any sample code, but if you are familiar
with Haskell you could look at the low-level source-code of
- the Haskell Web Server (in the fptools repository)
- {Erlang-style, Port-based} Distributed Haskell
Occasionally, you might find useful snippets on the GHC mailing
lists, e.g.
http://www.haskell.org/pipermail/glasgow-haskell-users/2003-March/004915.html
You might want to comment on the use of non-blocking IO and using Concurrent
Haskell instead of calling the C function 'fork' to implement a single
server using lightweight threads to serve multiple clients. 'hGetContents'
can be used to read all current (and future!) data so you can completely
abstract from the underlying IO and instead focus on getting work done.
Volker
--
http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME
rage against the finite state machine