How to detech FIN (Close) in TCP connection
<p>I'm just now learning how to use the Android/Java Socket class and I need to respond in a particular way to a Close (FIN, really) sent by the remote computer.  </p>

<p>The Socket class does not seem to be event-driven  (<a href="http://developer.android.com/reference/java/net/Socket.html" rel="nofollow">http://developer.android.com/reference/java/net/Socket.html</a>) i.e., there don't seem to be any <em>onThis</em> or <em>onThat</em> handlers, so what's the best way to become aware of when the remote computer sends a FIN?</p>

<p>Currently the Android OS responds to the FIN with an ACK, but I need to do things in my application as well so I need a way for my app to be alerted to this.</p>

<p>Thanks in advance!</p>
