Article View: borland.public.jbuilder.java.language
Article #7895Detecting a lost network connection
From: John Pruitt
Date: Sat, 12 May 2001 05:49
Date: Sat, 12 May 2001 05:49
8 lines
1421 bytes
1421 bytes
I have a Server Socket that waits for connections and then creates a thread to handle them. Once the network connection is made, I open a stream and datastream to it then wait for the remote computer to send some data while I'm doing other things. Is there some way (without blocking) to instantly detect that the connection has been lost if the remote computer breaks the connection. I've tried to use available(), but it doesn't throw an IOException if the connection is lost. It seems a waste of valuable bandwidth to send/receive data just to check if the connection is still alive.
Technical Details
Message-ID:
<3afccef7$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a5c5c1666f911a81,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-11 23:10:01 PST From: "John Pruitt" <john@branchsoft.com> Sender: "John Pruitt" <john@branchsoft.com> Reply-To: "John Pruitt" <john@branchsoft.com> Subject: Detecting a lost network connection Newsgroups: borland.public.jbuilder.java.language X-User-Info: 64.242.221.201 64.242.221.201 NNTP-Posting-Host: 207.105.83.65 Message-ID: <3afccef7$1_2@dnews> Date: 11 May 2001 22:49:43 -0700 X-Trace: dnews 989646583 207.105.83.65 (11 May 2001 22:49:43 -0700) Lines: 9 Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews