backlog problem?

Joanne Wing Yan Lai joannelai at yahoo.com
Tue Dec 6 06:39:53 UTC 2005


Hi,

I have implemented a simple java application (J2SE 1.4.2) in which
contains a server and a client.

The server side has a ServerSocket to listen to the client messages and
the client side has a for loop to create many socket to a specific port.

When I run the client, the following stack trace was printed after 4 or 5
sockets are created successfully.

java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
        at java.net.Socket.connect(Socket.java:426)
        at java.net.Socket.connect(Socket.java:376)
        at java.net.Socket.<init>(Socket.java:291)
        at java.net.Socket.<init>(Socket.java:119)
        at Client.main(Client.java:12)

I have tested this on both RedHat linux 7.2 and RHEL 3.0 AS and both fail.
However I run on Windows XP, it runs without any error.

I have increased the ServerSocket backlog parameter on the server side to
a bigger number (default is 50) but it makes no difference. Besides, I
have modified /usr/include/linux/socket.h in which the constant SOMAXCONN
is changed from 128 to 1024, but it doesn't help as well.

It seems to be there's some controls or limitations in RedHat Linux which
causes the program to throw exception when the clients connect faster than
the server can accept.

Any help is appreciated.



		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 




More information about the redhat-list mailing list