Re: Using Glib::IOChannel for socket connections
- From: Chris Vine <chris cvine freeserve co uk>
- To: "Víctor M. Palacio Tárrega" <victorpalacio adtelecom es>
- Cc: gtkmm-list gnome org
- Subject: Re: Using Glib::IOChannel for socket connections
- Date: Mon, 2 Feb 2009 23:09:24 +0000
On Mon, 02 Feb 2009 10:29:39 +0100
"Víctor M. Palacio Tárrega" <victorpalacio adtelecom es> wrote:
>
> Hi,
>
> I'm planning to manage remotely (or locally) a gtkmm graphical
> aplication through a network (or unix) socket.
>
> The use of Glib::IOChannel is not documented for use it in this case.
>
> I want a callback for a incoming connection, to accept it, treat
> received data and finally close the connection.
>
> Use of IOChannel documented is only when data is ready to read, after
> a connection is accepted.
>
> There exists some tutorial or documentationt about IOChannel use with
> network sockets? There exist another Glib object for this use?
The interface for sockets is ubiquitous and multiplatform and apart
from a few minor nuances the same in windows as in the POSIX interface,
so I should just use the normal socket(), bind(), listen(), accept()
calls. accept() will give you a file descriptor you can pass to
GIOChannel for reading - although depending on your needs that would
probably be overkill and recv()/read() may do what you want.
Since you seem to be programming in C++ I also have a streambuffer
class for file descriptors which will enable you to use normal istream
functionality with sockets and pipes and which I can point you to if you
want.
If you want a guide to programming the socket interfaces there are a
number on the web but this one is quite good:
http://beej.us/guide/bgnet/output/html/multipage/index.html
There was/is a GObject based library called gnet for socket programming
but I am not sure that it is still maintained. A google search should
tell you more.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]