timeout maximum is 20 seconds

N

Nigel Underwood

All,

I am trying to connect to a Socket on a remote machine that may take upto 1
minute to respond to the connection request. To allow for this, I am making
a time out on my connection request to be 5 minutes. However, I seem to be
having a problem in that even though I make the timeout 5 minutes, it
timesout only after 20 seconds. If I make the timeout less than 20 seconds
it works fine, but anything above 20 seconds makes the timeout 20 seconds.

I've listed my code below and for reference, its JVM 1.4.2_06.

try
{
Socket mySocket = new Socket(); // Create the socket
InetSocketAddress myAddress = new InetSocketAddress( "172.16.100.10",
25 );

// Wait for upto 5 minutes for a connection
mySocket .connect( myAddress , 300000 );

}
catch ( Exception e )
{
System.out.println( "** Error opening " + e.getMessage() );
}

Thanks guys

Nigel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top