Socket open to inavailable IP takes too long time  
Author Message
Son KwonNam





PostPosted: 2004-5-12 17:29:00 Top

java-programmer, Socket open to inavailable IP takes too long time On JDK 1.3(I HAVE TO use 1.3.. T.T).

When I open a socket to an IP which doesn't exist(for example
192.168.34.13 which does not exist), It takes too long time - almost
5~10 minutes.

I open a socket in a JSP page, when a lot of people try to open the page
and the IP to connect disapears(it disapears because of network
problems), the WAS goes down. because of alot of socket connections are
opened and continue trying to connect too long time.

I just want that the WAS doesn't fail and give customers an error message.

Is it possible to stop socket connection after 10 secs or some secs by
OS(Unix especially HP-UX) settings?

Or any other solutioin?

Thanks.

--
** Son KwonNam
http://kr.blog.yahoo.com/kwon37xi

Please DO NOT reply to this message's email address.
The address is fake.
 
Rob Shepherd





PostPosted: 2004-5-12 19:13:00 Top

java-programmer >> Socket open to inavailable IP takes too long time Son KwonNam wrote:
> On JDK 1.3(I HAVE TO use 1.3.. T.T).
>
> When I open a socket to an IP which doesn't exist(for example
> 192.168.34.13 which does not exist), It takes too long time - almost
> 5~10 minutes.
>
> I open a socket in a JSP page,

I don't know much about JSP but is it possible to have a previously constructed pool of
network connections which you can use to connect your jsp to wherever....
[assuming you connect to the same ip(s) every time]

Your jsp then does not open the connection it merely selects (requests) one to use from
the pool...

That way if there are no free connections you can politely ask the user to try again later...

and experiment with the max number of connections without unexpected results...

I am also assuming you can have persistent Java Objects running behing your JSP's

can you?

Anyone.. Anyone.. Bueller.. Bueller..

Rob
 
Roedy Green





PostPosted: 2004-5-12 23:39:00 Top

java-programmer >> Socket open to inavailable IP takes too long time On Wed, 12 May 2004 18:29:01 +0900, Son KwonNam
<email***@***.com> wrote or quoted :

>When I open a socket to an IP which doesn't exist(for example
>192.168.34.13 which does not exist), It takes too long time - almost
>5~10 minutes.

I discovered that Panda antivirus firewall was doing something odd. It
was letting the Opera browser through, but only after a minute delay
the first time. It turned out my configuration for Opera had not been
updated to reflect its new home directory.

Perhaps your firewall is doing something similar.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Steve Horsley





PostPosted: 2004-5-13 3:05:00 Top

java-programmer >> Socket open to inavailable IP takes too long time Son KwonNam wrote:
> On JDK 1.3(I HAVE TO use 1.3.. T.T).
>
> When I open a socket to an IP which doesn't exist(for example
> 192.168.34.13 which does not exist), It takes too long time - almost
> 5~10 minutes.
>
> I open a socket in a JSP page, when a lot of people try to open the page
> and the IP to connect disapears(it disapears because of network
> problems), the WAS goes down. because of alot of socket connections are
> opened and continue trying to connect too long time.
>
> I just want that the WAS doesn't fail and give customers an error message.
>
> Is it possible to stop socket connection after 10 secs or some secs by
> OS(Unix especially HP-UX) settings?
>
> Or any other solutioin?
>
> Thanks.
>

You could start another thread - call the socket constructor in another
thread and than wait with a 10-second timeout. If you don't get the
call-back from the socket constructor thread then send an error page
and set a flag to the socket constructor telling it "too late" and that
it should close and die ASAP.

You might be able to set a connect timeout on an unbound socket before
trying to connect if you're using 1.4. I haven't had a chance to look in
detail at that stuff.

Steve