Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9259
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Setting TCP parameters for Socket? |
| Date | Thu, 27 Oct 2011 23:35:15 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <j8ciqu$cqm$1@dont-email.me> (permalink) |
| References | <j8c20r$cmp$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 27 Oct 2011 21:35:26 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="JFBMxFU3Ar+OXfx8/NWLUw"; logging-data="13142"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fTLSbJjitXI9aWw9Fsq5C" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.23) Gecko/20110920 Thunderbird/3.1.15 |
| In-Reply-To | <j8c20r$cmp$1@dont-email.me> |
| Cancel-Lock | sha1:BTZtPzHH74OBNtWdWQ2216ii7KQ= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9259 |
Show key headers only | View raw
On 27/10/2011 18:48, markspace allegedly wrote: > 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? <http://download.oracle.com/javase/6/docs/api/java/net/Socket.html> Socket(InetAddress address, int port) Creates a stream socket *and connects it* to the specified port number at the specified IP address. Socket() Creates an *unconnected socket*, with the system-default type of SocketImpl. -- DF. Determinism trumps correctness.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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