Article View: borland.public.jbuilder.java.language
Article #7841Re: Detecting a lost network connection
From: Nabin Thomas
Date: Thu, 17 May 2001 18:16
Date: Thu, 17 May 2001 18:16
37 lines
2594 bytes
2594 bytes
This is a multi-part message in MIME format. --------------F3BE2F7860BB6B3C2BE6FE4C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Check out the setSoTimeout() method for socket I think this might be of some use for You. You can set this interval to a value instead of polling the connection. John Pruitt wrote: > 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. --------------F3BE2F7860BB6B3C2BE6FE4C Content-Type: text/x-vcard; charset=us-ascii; name="viewmycard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Nabin Thomas Content-Disposition: attachment; filename="viewmycard.vcf" begin:vcard n:Thomas;Nabin x-mozilla-html:TRUE adr:;;;;;; version:2.1 email;internet:DONOTSPAMME.nabinthomas@REMOVETHIShotmail.comANDTHISTOO note;quoted-printable:REMOVE the Capitalised letters in my email ID given in this card=0D=0A=0D=0AFeel free to contact me thru e-mail or MSN Mssenger =0D=0A if required but DONOT SPAM=0D=0A=0D=0A fn:Nabin Thomas end:vcard --------------F3BE2F7860BB6B3C2BE6FE4C--
Technical Details
Message-ID:
<3B04157A.63276F6D@foremail.nospamplease>Path:
arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3afccef7$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a5c5c1666f911a81 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-17 22:40:09 PST Message-ID: <3B04157A.63276F6D@foremail.nospamplease> Date: Thu, 17 May 2001 23:46:26 +0530 From: Nabin Thomas <viewmycard@foremail.nospamplease> X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Detecting a lost network connection References: <3afccef7$1_2@dnews> Content-Type: multipart/mixed; boundary="------------F3BE2F7860BB6B3C2BE6FE4C" NNTP-Posting-Host: 202.9.186.14 X-Trace: dnews 990163698 202.9.186.14 (17 May 2001 22:28:18 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews