Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fails to create new sockets, please HELP !!

15 views
Skip to first unread message

meghRa...@future.co.jp

unread,
Nov 20, 2000, 2:19:39 AM11/20/00
to

Fails to create new sockets, please HELP !!
--------------------------------------------------------------------
Client cannot create new sockets.
And if it happens on server, it cannot reply user`s request.

ENVIRONMENT :

Java and Socket(TCP/IP) programming
under JAVA based client/server environment.

PROBLEM EXPLANATION :

If client program tries to connect and disconnect large quantity of
TCP/IP sockets repeatedly in a very short time ( 20 to 100 sockets
per second ), the client side fails to create new sockets.

Right now, the problem is persistently on client side.
If it happens on server side, the server will be unable to reply
to client`s request.

Chekcing the result from "netstat" command, so many remaining
sockets are under TIME_WAIT state.I think this is the main reason
for above problem.

A TYPE OF SOLUTION, BUT IT IS NOT HELPFUL :

If one sets the TcpTimeWaitDelay to smallest(30)
[ check: HKEY_LOCAL_MACHINE\System\CurrentControlSet
\services\TcpIP\Parameters\TcpTimedWaitDelay ]
for now it seems okay. But this is a manual process, done manually.

ANOTHER BETTER PROGRAMMING SOLUTION REQUESTED :

Programs like BEA WebLogic never needs any manual settings.
So, it means the socket creation/deletion can be done WITHOUT
any TIME_WAIT. Or there is way to avoid the gathering of so many
sockets due to TIME_WAIT. I am looking for the Java programming
solution to this problem.

If anybody knows the way to avoid above problem and able to
control socket creation/delation without failing due to above
reasons(TIME_WAIT). Please send the SOLUTION idea =>
meghRa...@future.co.jp
so that we can control it from within our own program.
Thanks in advance.

The computer environment is:

C:\>ver
Microsoft Windows 2000 [Version 5.00.2195]

C:\>java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

C:\>netstat

Proto Local Address Foreign Address State
TCP CLIENT:1200 SERVER:serverport TIME_WAIT
TCP CLIENT:1201 SERVER:serverport TIME_WAIT
TCP CLIENT:1202 SERVER:serverport TIME_WAIT
TCP CLIENT:1203 SERVER:serverport TIME_WAIT
TCP CLIENT:1204 SERVER:serverport TIME_WAIT
TCP CLIENT:1205 SERVER:serverport TIME_WAIT
TCP CLIENT:1206 SERVER:serverport TIME_WAIT
TCP CLIENT:1207 SERVER:serverport TIME_WAIT
...
...
---------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.

Leon Lambert

unread,
Nov 20, 2000, 3:00:00 AM11/20/00
to
What is your server socket backlog set to?
API prototype.
public ServerSocket(int port,
int backlog)
throws IOException

Backlog is the size of the queue used for pending requests to connect.
If you server is blasted with request to connect faster than your
program to handle them you might be overflowing the backlog queue. Not
sure how NT handles the requests that fail to get queued but it may be
what you are seeing. Try setting the backlog queue size to something
like 100 if that is how many you are trying to blast it with.

Hope this helps
Leon Lambert

Duane Morse

unread,
Nov 20, 2000, 3:00:00 AM11/20/00
to
You might want to set the SO_LINGER socket option to 0 so that sockets are
closed as fast as possible,
though it means losing data which may be buffered awaiting transmission.
You might also want to try
explicitly dereferencing socket variables when you're done with them to make
them available to the garbage collector.

<meghRa...@future.co.jp> wrote in message
news:8vaja9$o18$1...@nnrp1.deja.com...

0 new messages