Re: Can I listen on a socket in a GTK application?



Hi,

(I'm moving the discussion back to gtk-list as I didn't actually mean
to send it private. Hope it is ok with you.)

Regarding your question, yes, gtk_main() is really a wrapper to
g_main_run(main_loop), so everything that is valid for g_main_loop()
is valid for gtk_main() as well. Just set up your gnet callback
handlers and then call gtk_main().

Hope this helps.

Regards,
Dov


On 3/25/06, yinglcs2 yahoo com <yinglcs2 yahoo com> wrote:
> Dov,
>
> Thanks for your respond. I am interested in knowing
> how you did that.
>
> I have read the example you suggest. But one thing I
> am not sure is if I still call "gtk_main();"?
> And when does it call "gtk_main() now if I call
>   /* Start the main loop */
>   g_main_run(main_loop);
>
> from the gnet example?
>
> Thank you.
>
> --- Dov Grobgeld <dov grobgeld gmail com> wrote:
>
> > It sure is. One of the easiest ways is to use gnet.
> > Have a look at the
> > gnet-*/examples/echoserver-gserver.c program in the
> > gnet sources that
> > shows you how to creates a server that integrates
> > with the glib main
> > loop.
> >
> > I'm using exactly that approach for
> > remotecontrolling a gtk based
> > image viewer application by sending it tcp-ip
> > commands .
> >
> > Regards,
> > Dov
> >
> > On 3/22/06, yinglcs2 yahoo com <yinglcs2 yahoo com>
> > wrote:
> > > In my GTK application, is it possible for it to
> > listen
> > > on a socket (as a server)?
> > >
> > > Thank you.
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > > _______________________________________________
> > > gtk-list mailing list
> > > gtk-list gnome org
> > > http://mail.gnome.org/mailman/listinfo/gtk-list
> > >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]