Re: [gnet] G_IO_Condition on a iochannel for a socket



Ah, thanks!!
Perhaps you could include an explanaition about this in the documents.
I can also make this change for you if you like, and send in a doc-patch.

Thanks a lot,

Aschwin


Andrew J Lanoix wrote:

What you describe is the correct behavior. When a client disconnects you
get a G_IO_IN and a read of 0. The G_IO_IN is used to signal that your
received something, and the read of 0 is the standard way sockets say the
other end closed the connection. Take a look at the gnet's  echoserver &
echoclient --async examples.

Andy

On Wed, 27 Jun 2001, Aschwin van der Woude wrote:

Hi,

It is not clear to me if this question belongs on this list or on the
glib-list, so please forgive and correct me if this questions belongs to
the glib-list.

We are not members of this mailinglist, so please cc: the reply to us.

I am participating in a small game-project. For this project we build a
client/server, decided to use gnet and glib, and use TCP/IP as a network
protocol.

Everything works fine, accepting connections, receiving data and so forth.
We use g_io_add_watch() to received socket/iochannel conditions.

But we noticed when the client-side hangs up the connection (tested with
telnet), a condition G_IO_IN is issued on the server.
There is no data to be received from the stream, so currently we used
this condition and this last fact to assume the otherside of the
connection has hung up. This solution seems to work fine for our
test-cases, but I doubt it is the correct solution.

We initially expected a G_IO_HUP condition to be received when the
otherside of the connection is closed.

We currently use the following versions :

glib version:    1.2.10-ximian.2
gnet version:    1.0.4-ximian.2

Could you shed some light on this curiosity?


Thanks,

Aschwin

--

  If I have been able to see further,
  it was only because I stood on the shoulders of giants.

                                   Sir Isaac Newton



_______________________________________________
gnet mailing list
gnet gnetlibrary org
http://www.gnetlibrary.org/mailman/listinfo/gnet



--
Aschwin van der Woude
Open source specialist


  If I have been able to see further,
  it was only because I stood on the shoulders of giants.

                                   Sir Isaac Newton
Netmill

Phone:             +358 2 512 44 00
Fax:               +358 2 512 44 11
Direct:            +358 2 512 44 70
Mobile:            +358 50 5676665
Visiting address:  Läntinen Pitkäkatu 35
                  FIN - 20100 Turku, Finland

--------------------------------------------------------------------------
This e-mail is confidential and may contain legally privileged
information. It is intended solely for the addressee(s)and access by
anyone else is unauthorised. Disclosure, copying or distribution, in whole
or part, is strictly prohibited. If you are not the intended recipient,
please notify us immediately by telephone or e-mail and delete this
message and any attachments from your system without retaining a copy.

E-mail may be subject to data corruption, interception, unauthorised
amendment, tampering and viruses. We only send and receive e-mails on the
basis that we are not liable for any such corruption, interception,
amendment, tampering or viruses or any consequences thereof.
--------------------------------------------------------------------------






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