Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-06-2005, 03:54 AM
|
#1
|
LQ Newbie
Registered: Dec 2005
Posts: 3
Rep:
|
Connection Refused
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 and it doesn't help as well.
I even tested a similar program of Client Socket in C++ to connect to port 3306, but the exception "Could not bind to port." was caught after 5 or 6 sockets are created. So I am quite sure it's sth wrong with the OS (RedHat Linux).
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.
|
|
|
12-06-2005, 06:50 AM
|
#2
|
Member
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661
Rep:
|
i dont think this have anything to do with network, maybe some missing lib in linux that you have in windows.
|
|
|
12-07-2005, 01:54 AM
|
#3
|
LQ Newbie
Registered: Dec 2005
Posts: 3
Original Poster
Rep:
|
No, it must be limitation with the Linux 'coz the same program works fine in Windows. I posted a query in Java forum and somebody told me it maybe limited by backlog which is OS dependent, but I have no idea which configuration should be modified to increase the backlog under Linux. (I tried using the method in Java to modify the backlog but no help)
Does somebody has idea to this problem?
|
|
|
12-07-2005, 05:40 AM
|
#4
|
Member
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661
Rep:
|
yeah, I believe it have something to do with some missing librarie and stuff, thats the point, what librarie, what stuff, but strange is not your question, is where you ask it. Maybe in the Programming Subforum you would get better result...
regards
[ ]'s
|
|
|
12-11-2005, 10:42 PM
|
#5
|
LQ Newbie
Registered: Dec 2005
Posts: 3
Original Poster
Rep:
|
Somehow this problem is not program dependant. I even run a simple C++ socket program in Linux but similar result is returned. What I wonder is if there's some configurations in Linux can be modfiied to increase the backlog to a reasonable value.
|
|
|
All times are GMT -5. The time now is 01:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|