Results 1 to 5 of 5
Thread: Socket Connection problem
- 02-04-2010, 06:04 PM #1
Member
- Join Date
- Feb 2010
- Location
- Athens, Greece
- Posts
- 1
- Rep Power
- 0
Socket Connection problem
Hi,
I have developed a client server application. Server also comunicates with a mysql server located on the same computer.
Server accepts standard tcp connections. Each connection goes to its own thread. Application runs ok, but (there is a "big" but here)
sometimes server for some unknown reason stops accepting connections or responding to already connected clients without throwing an exception.
Server GUI is responding, however (there are some buttons on the server application that work). But client hangs. It just hangs. Strange is also the fact that client does not shut down (i.e. pressing the
'x' button) until server is shut down. It might be a client's error, but I don't get an exception there, either.
I have been trying all day to see what's going on. I can post any code if asked. I need a hint. Whatever. Something to unblock me.
any help would be much appreciated.
- 02-04-2010, 09:08 PM #2
Member
- Join Date
- Nov 2007
- Location
- New Zealand
- Posts
- 36
- Rep Power
- 0
I don't mean to sound silly but I would look at the code point where the connections are being established. Specifically to see if there is a bottleneck there. Also check that you're not catching and silently discarding exceptions.
If you have any more info, happy to help.
Best of luck
- 02-14-2010, 01:46 PM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
My guess is that you are running out of file descriptors because you are failing to call 'close' on your sockets when a client disconnects. What do the stack traces tell you?
- 02-14-2010, 04:28 PM #4
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Maybe it's time to write stress test for your server.
Be sure you throw most specific Exceptions and print it.
From what i can read you could use:
backlog - the maximum length of the queue (default is 50 connections)Java Code:public ServerSocket(int port, int [B]backlog[/B]) throws IOException
Im' posting you 2 important links you shuold examine,
but in short:
"At the beginning connections should be handled by a different thread, allowing ServerSocket to check immidiately for the next one, and back to
the accept(). " Pay attention on the end of cycle - how you close connenction and are there any exception.
You cound use some traffice sniffer like 'Wireshark'
to check what is going on on TCP level, and catch some incomplete request/response.
Here are links for help:
java server's ability to accept a huge number of simultaneous connections
and
Java Programming - Make server stop accepting connections for some condition
good luck!
- 02-14-2010, 04:32 PM #5
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Similar Threads
-
Socket connection - MIDlet
By arun10427 in forum CLDC and MIDPReplies: 2Last Post: 01-26-2010, 02:51 AM -
Error in establishing socket connection
By saso1310 in forum JDBCReplies: 2Last Post: 05-18-2009, 01:00 PM -
[SOLVED] problem in socket connection
By neeraj.singh in forum NetworkingReplies: 2Last Post: 02-20-2009, 01:33 PM -
problem in socket connection in sending images
By vibhor in forum NetworkingReplies: 2Last Post: 02-20-2009, 05:39 AM -
How To Make Socket Connection
By madhumurundi in forum NetworkingReplies: 5Last Post: 04-21-2008, 06:05 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks