Re: Sockets and g_io_channel



        If the server is meant to support multiple users this might not work as
expected. Your original idea was someone correct:

1. sock = socket()
2. bind(sock, ...)
3. listen(sock, ...)
4. ioch = g_io_channel_new (sock, ...)
5. in io_channel callback -> conn = accept (sock, ...)
5.1 in io_channel callback -> new_io = g_io_channel_new (conn, ...)

        that way you have one socket constantly listening for new connections
and all the sockets returned by accept will be connection to clients.

        HTH, Mitko

On 08 Nov 2002 08:26:06 +0100
Juan Agüí wrote:

   > El vie, 08-11-2002 a las 01:21, chen.shengqi escribió:
   > > 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 )
   > > 
   > 
   > Good idea. Right now i create the socket, attach to a giochannel,
and
   > await for connection in the watch function . But i think your
approach
   > is far better. Thanks a lot . Juan.
   > 
   > 
   > 
   > 
   > > > 



-- 
========================================================================
     __  __  __________________ _________
    /  |/  |/  /__/__   ___/  |/  /     /      Dimitar Haralanov
   /          /  /  /  /  /      /  /  /       Software Engineer
  /   /   /  /  /  /  /  /  /\  \  /  /        Tahoe Networks
 /___/___/__/__/  /__/  /__/  |__|___/         mitko tahoenetworks com

========================================================================
  GPG Fingerprint:  21C1 8244 93F3 F2E9 013C  0C12 70DC C58E 6337 ABD1
-----------------------------------------------------------------------
-I'd rather push my Harley than ride a rice burner.

Attachment: pgpnE231TFQhS.pgp
Description: PGP signature



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