Re: Sockets and g_io_channel
- From: "chen.shengqi" <chen shengqi connet com tw>
- To: "Harring Figueiredo" <harringf yahoo com>, Juan Agüí <jagui die upm es>, "gtk-app-devel-list" <gtk-app-devel-list gnome org>
- Subject: Re: Sockets and g_io_channel
- Date: Fri, 8 Nov 2002 08:21:39 +0800
you should accept a connect from remote then Create a g_io_channel with the connected socket fd.
connfd = accept(...)
newiochnl = =g_io_channel_new(connfd )
Juan,
Just out of curiosity, have you looked at gnet library ?
HArring.
--- Juan Agüí <jagui die upm es> wrote:
Sorry, no subject in previous message...
Hi everyone!
I developing an OSI protocol stack. I need one layer to communicate with
another through a socket. The server application will be the Link Layer
and the client application will be the Application Layer.
The server waits for incoming datagrams listening on the socket and the
client writes datagrams in the socket. Both are programmed in gtk+2 as
they need GUI capability. There's not much info about g_io_channel and
socket, so please tell me if this approach is wrong:
Server:
1)Create a socket: sock=socket(..)
2) Bind it to a port: bind(...)
3) Make it listen: listen(...)
4) Create a g_io_channel: fd=g_io_channel_new(sock)
5) Add a watch to the io_channel to act in response of incoming
datagrams
Client:
1)Create a socket: sock=socket(..)
2)Create io_channel
3) ¿Should i call "connect"
4) write to the io_channel
Im getting this runtime error: "GLib-CRITICAL **: file giochannel.c:
line 1914 (g_io_channel_write_chars): assertion `channel->is_writeable'
failed"
Suggestions? Thanks in advance.
--
Juan Agüí Martín
ETSI Telecomunicación
C. Universitaria S/N Dpcho B-205
Madrid 28050 Spain
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]