Re: Setting TCP parameters for Socket?
- From: Steven Simpson <ss@xxxxxxxxxxxxxx>
- Date: Thu, 27 Oct 2011 20:41:07 +0100
On 27/10/11 17:48, markspace wrote:
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.
Is anything stopping you from created an unconnected Socket, then calling connect() on it, with the timeout specified as an argument?
You could also try setSoTimeout() between the constructor and connect(), but it appears to be for reads, not necessarily connects. Of course, that might be the only way for other socket options.
--
ss at comp dot lancs dot ac dot uk
.
- Prev by Date: Re: How to check if the n-th part of an array of Strings exist?
- Next by Date: Re: Setting TCP parameters for Socket?
- Previous by thread: What is better Java with Python or Java with Ruby ?
- Next by thread: Re: Setting TCP parameters for Socket?
- Index(es):
Relevant Pages
|