Re: gmain loop and listening on a port

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

 



On Friday 05 August 2005 10:44, Tim Fulcher - Clickatell wrote:

> I'm trying to listen on a socket and am restricted to using g_main_loop,
> I have set up the socket and have attached the socket to the gmainloop
> as using g_io_add_watch and then using "accept()" but the port will only
> listen once.
>
> So I tried using select() to read the port and polled that port using
> g_idle_add and that had the same result.
>
> I've attached my code (showing both attempts, one commented out), Surely
> somebody must have done this before?

Have you considered using one of the GLib-based networking libraries out 
there, like:

 *  GNet (http://www.gnetlibrary.org), esp. GServer/GConn API
 *  GNetwork

They take care of all the low-level stuff and the main loop integration for 
you, and all you need to do is set your callbacks and that's it. Also, your 
code will probably be much more portable that way.

Cheers
 -Tim
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux