[Haskell] A simple server (or how to do io).
Pupeno
pupeno at pupeno.com
Tue Dec 20 23:13:09 EST 2005
On Tuesday 20 December 2005 23:43, Einar Karttunen wrote:
> Your problem is that the ghci prompt *is* blocking everything. ghci is
> builded non-threaded. Ghci uses a blocking call to read the lines
> which means that all other computations are stopped.
Ok, then pressing enter each time I want one of my servers to reply. I can
live with that.
> > I compile it and run it. It returns immediately and the server of course,
> > is not running.
>
> It spawns the server threads and returns immediately.
Indeed.
> > I think what I am missing is that server, after running runStreamServer
> > should block and be able to reply to all the queries (in the final
> > version I'll also have runDgramServer as well) and be able to receive a
> > signal, upon which it should close the socket and finish. How can do that
> > ? Any help will be appreciated.
>
> Catch the signal and kill the listening threads. If you
> are using the new 0.3.1 release then you can use the
> killServer call.
Oh, new release, I am downloading it right now!
So, I install a signal handler with installHandler... and then ? how do I
prevent the program for quiting ? am I missing some kind of event loop here ?
> ps. I think it may be best to continue on haskell-cafe@ rather
> than the main list.
I am posting to there as well (to continue there).
--
Pupeno <pupeno at pupeno.com> (http://pupeno.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20051221/e2249fa6/attachment.bin
More information about the Haskell
mailing list