Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #19430
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Steven Simpson <ss@domain.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: detecting Socket disconnect |
| Date | Thu, 18 Oct 2012 09:31:27 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 16 |
| Message-ID | <vbr4l9-nu4.ln1@s.simpson148.btinternet.com> (permalink) |
| References | <c46d29c6-f804-43da-b748-ef50c3a8bdfa@googlegroups.com> <asnu3x7eu41t.5lxnh3cm080e$.dlg@40tude.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx04.eternal-september.org; posting-host="e7be46fa422c8d3b64881aea51e84d96"; logging-data="4969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PMg0zABB/Pu8CdKJsyxNansp/2UaVKpQ=" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
| In-Reply-To | <asnu3x7eu41t.5lxnh3cm080e$.dlg@40tude.net> |
| Cancel-Lock | sha1:bD6B0z7bmtA3lb7CVIiY258SCAo= |
| Xref | csiph.com comp.lang.java.programmer:19430 |
Show key headers only | View raw
On 17/10/12 21:59, Peter Duniho wrote: > On Wed, 17 Oct 2012 13:12:13 -0700 (PDT), bob smith wrote: >> I have a java.net.Socket that I only write to, and I can't figure out how to tell if it's disconnected. > The normal way to detect a disconnect is to read from the socket and get a > return value of 0 bytes for the count of bytes. This is the case in C, where functions like recv() use -1 to signal an error and 0 for EOF. However, in Java, InputStream (such as you get from a Socket) returns -1 to signal EOF. <http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html> -- ss at comp dot lancs dot ac dot uk
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
detecting Socket disconnect bob smith <bob@coolfone.comze.com> - 2012-10-17 13:12 -0700
Re: detecting Socket disconnect Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 16:45 -0400
Re: detecting Socket disconnect Lew <lewbloch@gmail.com> - 2012-10-17 13:47 -0700
Re: detecting Socket disconnect Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 17:19 -0400
Re: detecting Socket disconnect Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-10-17 13:59 -0700
Re: detecting Socket disconnect Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 17:24 -0400
Re: detecting Socket disconnect Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-10-17 14:42 -0700
Re: detecting Socket disconnect Steven Simpson <ss@domain.invalid> - 2012-10-18 09:31 +0100
Re: detecting Socket disconnect Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-10-18 07:09 -0700
Re: detecting Socket disconnect Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-17 21:14 +0000
Re: detecting Socket disconnect Roedy Green <see_website@mindprod.com.invalid> - 2012-10-17 15:52 -0700
csiph-web