SocketTimeoutException: Read timed out

I

ivan.andrisek

Hi everybody,

I have a strange thing happening (at least to me) in my java program
and would appreciate help on the issue:

I am running on JRE 1.4.2_10 and using HttpUrlConnection class to
exchange some XML files with another machine and sometimes I get the
"SocketTimeoutException: Read timed out" exception.

What confuses me is the fact that in Java1.4.2, HttpUrlConnection class
does not support defining SO_TIMEOUT (as in Java1.5) which means that
my SO_TIMEOUT by default is 0 ==> indefinite.

Why do I get those Timeout Exceptions that? Is is possible that the
other side (that I am sending the XML file to) is denying connection
which causes this exception on some hidded socket classes inside
HttpUrlConnection?

Thanks in advance!
Ivan
 
J

js

Hi everybody,

I have a strange thing happening (at least to me) in my java program
and would appreciate help on the issue:

I am running on JRE 1.4.2_10 and using HttpUrlConnection class to
exchange some XML files with another machine and sometimes I get the
"SocketTimeoutException: Read timed out" exception.

What confuses me is the fact that in Java1.4.2, HttpUrlConnection class
does not support defining SO_TIMEOUT (as in Java1.5) which means that
my SO_TIMEOUT by default is 0 ==> indefinite.

Why do I get those Timeout Exceptions that? Is is possible that the
other side (that I am sending the XML file to) is denying connection
which causes this exception on some hidded socket classes inside
HttpUrlConnection?

Thanks in advance!
Ivan

IIRC, it is OS dependent. In Linux, at least starting with kernel 2.6 ( not
sure with 2.4 ), you can set TCP keep-alive timeouts and interval
in /etc/sysctl.conf:

net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 30
 
E

EJP

No. The other end is certainly *not responding* with data, and you need
to investigate that. I'm not aware that any implementation of
HttpURLConnection sets a read timeout other than the user-defined one
@since 1.5.
IIRC, it is OS dependent.

Nope. In every implementation of sockets the default read timeout is
supposed to be infinite.
In Linux, at least starting with kernel 2.6 ( not
sure with 2.4 ), you can set TCP keep-alive timeouts and interval
in /etc/sysctl.conf:

Keepalive has nothing to do with read timeouts.
 
I

ivan.andrisek

Hi!

After further investigation, and talking with "the other end" i found
out that the other side has
timeout set to a very low value (1 second) which, in case of slower TCP
connection, caused all the exceptions.

thanks a lot for the tip!

BR
Ivan
 
Joined
Nov 1, 2012
Messages
1
Reaction score
0
read time out excetion in httppost

Hi,

We have adaptor jar (java ) which send some xml data to another web component deployed on other linux box using httppost method but after couple of hours I am getting read time out excetion in the adaptor and it is not able to send data.
Once I restart the web component then again it work for some time.
can any one help me to figure out the probel and how to fix this?
 

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top