comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Sockets Example Sought
Date: Tue, 27 Nov 2012 09:41:32 +0100
Date: 2012-11-27T09:41:32+01:00	[thread overview]
Message-ID: <rvvlld0tulyf.d0ssrgc4s8ea.dlg@40tude.net> (raw)
In-Reply-To: 2012112621374336634-rblove@airmailnet

On Mon, 26 Nov 2012 21:37:43 -0600, Robert Love wrote:

> BTW, is there an official way to tell when the client closes the 
> socket?

None of the transport's business, which TCP/IP is.

> When  I'm reading data, I can tell.   If I'm not reading data, 
> I can call the Get_Peer(socket) function and catch an exception.  It 
> just seems there should be another way?

Normally there are multiple further layers mounted on the TCP/IP transport
stream, up to the application level. These are usually stateful, and they
may have states corresponding to a desire to disconnect, on either side
depending on the roles the sides play. [Provided, that the protocol is
connection-oriented. There are protocols which are not connection-oriented,
even though using TCP/IP as the transport. For them whether the other side
is gone might be just irrelevant.]

Of course ether side must be prepared to anticipate protocol errors and
connection loss is just one of them. Connection-oriented protocols usually
have corresponding states for this, In such a state the participants would
roll back, one of them would try to restore connection etc.

The bottom line is, usually you would not care actively checking it. Once
you experience an error you react correspondingly. [Keep-alive issues is
another story.]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-11-27  8:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 17:17 Sockets Example Sought Robert Love
2012-11-23 18:32 ` Simon Wright
2012-11-23 21:58   ` Robert Love
2012-11-23 22:40     ` Dmitry A. Kazakov
2012-11-24 18:27       ` Robert Love
2012-11-24 21:01         ` Dmitry A. Kazakov
2012-11-27  3:37           ` Robert Love
2012-11-27  8:41             ` Dmitry A. Kazakov [this message]
2012-11-27 15:05             ` Mark Lorenzen
2012-11-23 23:08     ` Simon Wright
2012-11-28  4:43 ` anon
2012-11-30  5:04   ` Robert Love
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox