What I have learned from my experience with TCP/IP is that connection / session 
control should always be achieved over the application protocol. To put it 
another way, as others have said already, graceful disconnection should be 
signalled using some specific means over your application protocol, at which 
point both sides know the exchange is finished and can close their ends of the 
socket simultaneously. A graceful disconnection should not be done by closing 
the socket at one end and then having the opposite end try to detect the 
closure. Some APIs like Java sockets don't seem to reliably inform you that the 
other end has closed until you try to write to the stream and get an exception. 

It's worth looking at how popular existing protocols over TCP/IP do this. HTTP 
is a great example.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to