Socket open to inavailable IP takes too long time

S

Son KwonNam

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

Rob Shepherd

Son said:
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
 
R

Roedy Green

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

Steve Horsley

Son said:
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
 

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,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top