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


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

Setting TCP parameters for Socket?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Setting TCP parameters for Socket?
Date Thu, 27 Oct 2011 09:48:23 -0700
Organization A noiseless patient Spider
Lines 16
Message-ID <j8c20r$cmp$1@dont-email.me> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 27 Oct 2011 16:48:27 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="13017"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19s94djNdm4N30FmdfsSZ8a/4cE/2t9ZLk="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
Cancel-Lock sha1:Bm/I81PYaseSrke91NP5tNLUhNg=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9251

Show key headers only | View raw


Sahm's post reminded me about this:

Investigating Socket::isReachable() a while back, I discovered that the 
Socket constructor actually establishes a TCP connection.  This means 
you can't set TCP parameters for the inital connection.  For example, 
SO_TIMEOUT.

   Socket sock = new Socket( hostname, port );
   sock.setSoTimeout( 6000 );    // too late!

There's no way that I can see to change the time out of the initial 
connection, which occurs in the first line above, in the constructor. 
You can set the time out for subsequent reads, but not the first connect.

Does anyone know of a way to control various TCP parameters, esp. the 
time out, for the Socket constructor?

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


Thread

Setting TCP parameters for Socket? markspace <-@.> - 2011-10-27 09:48 -0700
  Re: Setting TCP parameters for Socket? markspace <-@.> - 2011-10-27 10:10 -0700
    Re: Setting TCP parameters for Socket? markspace <-@.> - 2011-10-27 11:16 -0700
  Re: Setting TCP parameters for Socket? Steven Simpson <ss@domain.invalid> - 2011-10-27 20:41 +0100
  Re: Setting TCP parameters for Socket? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-10-27 23:35 +0200
    Re: Setting TCP parameters for Socket? markspace <-@.> - 2011-10-27 15:40 -0700

csiph-web