Sockets and g_io_channel



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




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