Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > SocketTimeoutException: Read timed out

Reply
Thread Tools

SocketTimeoutException: Read timed out

 
 
ivan.andrisek@gmail.com
Guest
Posts: n/a
 
      08-10-2006
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

 
Reply With Quote
 
 
 
 
js
Guest
Posts: n/a
 
      08-11-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> 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
 
Reply With Quote
 
 
 
 
EJP
Guest
Posts: n/a
 
      08-11-2006
js wrote:

> (E-Mail Removed) wrote:
>
>>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?


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.

>>
>>Thanks in advance!
>>Ivan

>
> 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.
 
Reply With Quote
 
ivan.andrisek@gmail.com
Guest
Posts: n/a
 
      08-11-2006
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

> 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.


 
Reply With Quote
 
anupam anupam is offline
Junior Member
Join Date: Nov 2012
Posts: 1
 
      11-01-2012
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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection timed out problem Stan Firefox 8 02-19-2005 12:46 PM
Getting "timed" out on Linksys wireless network =?Utf-8?B?dHJveV95?= Wireless Networking 2 12-26-2004 11:56 PM
[RMI] SocketTimeoutException: Read timed out Andre Raue Java 2 04-14-2004 11:51 AM
com.oreilly.servlet.multipart gets "Read timed out" when uploading files gsoapacct@yahoo.com Java 0 02-24-2004 06:07 PM
System.Web.HttpException: Request timed out - [HttpException (0x80004005): Request timed out.] Steve ASP .Net 0 07-01-2003 12:11 AM



Advertisments