Yes, that is what i meant... Otherwise, nothing much you can do about this.



On Tuesday, April 2, 2013 6:53:25 PM UTC+3, plnelson wrote:
>
>
> Just to clarify- when you say "add another command", do you mean add a 
> command to the PC to send to the Android device that it's closing?    That 
> would be a good solution but I don't know if I have any control over what 
> the PC sends.    This is the first and only Android/Java device on that 
> network and I think the assumption is that *of course* the Android app 
> will just know or get an event when the PC closes the connection.    The 
> other devices on that network are either Windows PC's running sockets that 
> fire-off event handlers when the connection is closed, or specialized 
> manufacturing hardware running Linux with low-level custom code to detect 
> things like FINs and RST's.   Android is my first exposure to java so I 
> didn't know, either.
>
> Maybe if I show the PC people this conversation it will help.      Thanks. 
>     
>
> On Tuesday, April 2, 2013 10:50:03 AM UTC-4, Piren wrote:
>>
>> Thats how it works in Java... 
>>  
>> http://stackoverflow.com/questions/155243/why-is-it-impossible-without-attempting-i-o-to-detect-that-tcp-socket-was-grac
>>  
>> <http://stackoverflow.com/questions/155243/why-is-it-impossible-without-attempting-i-o-to-detect-that-tcp-socket-was-grac>
>>
>> You shouldn't base your socket state to display this information anyhow, 
>> since you could have the exact same issue for any other kind of 
>> disconnection (i.e, it will appear "live" but once a command will be sent 
>> the socket will fail or when the KeepAlive runs out... which is btw an 
>> already existing "timer controlled loop that polls endlessly just to find 
>> out if the server has closed the connection" .. hehe ). Instead add another 
>> command to signal the device that the PC chose to close the connection. 
>>
>>
>> On Tuesday, April 2, 2013 5:02:08 PM UTC+3, plnelson wrote:
>>>
>>> I'm writing software for an Android device used as a remote control for 
>>> an industrial process being run by a PC.   The PC is always listening and 
>>> the Android device opens a connection via the Android socket class, which 
>>> provides a client-side TCP socket.     Once the connection is established 
>>> commands flow back and forth over the connection.     The PC can close the 
>>> connection at any time, issuing a FIN, asynchronously.   My requirement is 
>>> that I display this on the Android device as soon as it happens.
>>>    
>>> Studying the Android socket, it does not seem to be event driven.   
>>> There doesn't seem to be any way to raise an event or a callback if the 
>>> server closes the connection.   It looks like the first sign I'll have is 
>>> getting an error if I try to send something.     Is this true or am I 
>>> misunderstanding something?    The guys on the PC side don't believe it 
>>> because they say that their TCP socket software raises an event and calls a 
>>> handler if a connection is closed on the other end.
>>>
>>> So does this mean I'm going to have to sit in a timer-controlled loop 
>>> and poll endlessly just to find out when the server has closed the 
>>> connection or am I overlooking a better option?    
>>>
>>> Thanks in advance.
>>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
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 android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to