Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22324

Re: connect timeout

X-Received by 10.66.155.41 with SMTP id vt9mr1200566pab.11.1360941684137; Fri, 15 Feb 2013 07:21:24 -0800 (PST)
X-Received by 10.50.186.133 with SMTP id fk5mr251936igc.0.1360941683904; Fri, 15 Feb 2013 07:21:23 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!newsfeed.news.ucla.edu!usenet.stanford.edu!kc14no3629539pbb.1!news-out.google.com!jm3ni9pbb.0!nntp.google.com!kc14no3629534pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Fri, 15 Feb 2013 07:21:23 -0800 (PST)
In-Reply-To <511e3c98$0$284$14726298@news.sunsite.dk>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 173.164.137.214
References <c45c592d-9d52-490b-b2d0-66eaaff38123@googlegroups.com> <511e3c98$0$284$14726298@news.sunsite.dk>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <8ccab9d7-d86a-40c5-bf0f-1bdea1c5237d@googlegroups.com> (permalink)
Subject Re: connect timeout
From Lew <lewbloch@gmail.com>
Injection-Date Fri, 15 Feb 2013 15:21:24 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:22324

Show key headers only | View raw


Arne Vajhoej wrote:
> bob smith wrote:
>> Is there any way to specify the connection timeout for a java.net.Socket?
> 
>> I might want something like this to throw a ConnectException within 10 seconds:
>
>> Socket socket = new Socket(ip_address, 80);
> 
> http://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html
> 
> explains how to change default connect and read timeout for SUN/Oracle
> implementation.

The two-lines-of-code approach doesn't require an exogenous declaration of 
the property, which is an advantage if you don't want to rely on the correct
invocation of the program and a disadvantage if you want the same code to 
handle different configurations.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

connect timeout bob smith <bob@coolfone.comze.com> - 2013-02-14 11:22 -0800
  Re: connect timeout Lew <lewbloch@gmail.com> - 2013-02-14 12:38 -0800
  Re: connect timeout Arne Vajhoej <arne@vajhoej.dk> - 2013-02-15 08:48 -0500
    Re: connect timeout Lew <lewbloch@gmail.com> - 2013-02-15 07:21 -0800
    Re: connect timeout mike7411@gmail.com - 2013-02-15 08:07 -0800
      Re: connect timeout Arne Vajhoej <arne@vajhoej.dk> - 2013-02-15 12:05 -0500
        Re: connect timeout "John B. Matthews" <nospam@nospam.invalid> - 2013-02-16 13:21 -0500

csiph-web