Re: Gnome, Gtkmm and sockets



On Tuesday 17 May 2005 14:13, Fabio Rafael da Rosa wrote:


> Thanks..
> I saw that glib has socket functions, will check when I had some spare
> time... :)

Sockets are one of the few things for which Windows natively offers the same 
programming interface as POSIX, so as it is platform independent why not use 
what the OS provides?  So far as concerns reading and writing, you can use a 
Glib::IOChannel object for that purpose, but I don't think Glib::IOChannel 
offers a great deal to the C++ programmer.  If you want formatted input and 
output you would be better off using the C++ streambuffers, which are 
provided for that purpose (I can provide you with my streambuffers for 
reading and writing to sockets, pipes and fifos if you are interested).

If you need to plumb the socket file descriptor into the Glib::MainContext 
event loop, you can then use Glib::signal_io().connect() rather than having 
the overhead of a Glib::IOChannel object (see 
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1SignalIO.html
)

Chris

-- 
Summer is y-cumen in, lhude sing, cuccu!
Groweth sed and bloweth med, springeth the wude nu.



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