English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
lablgtk2: receiving messages from network?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-04-15 (20:58)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] lablgtk2: receiving messages from network?
On Sat, Apr 15, 2006 at 03:33:36PM -0400, Ivan Matveich wrote:
> I'm writing a gtk program that must receive data through a tcp
> connection and react to it immediately.
> What's the best way to implement this?
> Can gtk call me back when data is available on a socket?
> How do I use Marshal without blocking?

You can use the Glib.IO interface to create a glib io_channel from
your TCP socket, and then use add_watch to associate a callback with
it.  Your socket will then be polled as part of the Glib main event loop.

Eric Cooper             e c c @ c m u . e d u