Results 1 to 5 of 5
  1. #1
    xpan is offline Member
    Join Date
    Feb 2010
    Location
    Athens, Greece
    Posts
    1
    Rep Power
    0

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

  2. #2
    Turtle is offline Member
    Join Date
    Nov 2007
    Location
    New Zealand
    Posts
    36
    Rep Power
    0

    Default

    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

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    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?

  4. #4
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    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:

    Java Code:
    public ServerSocket(int port,
                        int [B]backlog[/B])
                 throws IOException
    backlog - the maximum length of the queue (default is 50 connections)

    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!

  5. #5
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Quote Originally Posted by RXD View Post
    I have used the exampmle project Sockets which is given in symbian SDK2.1 supporting VC++. It works as usual when use Free Internet Chess Server (FICS) as server name and port no 80. But does not work when give port no 5000. But on port 5000 their is service.When I use socket class of Java as socket=new Socket("www.freechess.org", 5000) it also work and return appropriate message. I want to use it in symbian (Using vc++) by using socket class.

    Please, please, please help !!!.
    I think it would be best for you to start new thread.
    Looking forward to help you :)
    Plese explain in your new Thread in details network problem -
    what is inside and outside your network and what you want to call

Similar Threads

  1. Socket connection - MIDlet
    By arun10427 in forum CLDC and MIDP
    Replies: 2
    Last Post: 01-26-2010, 02:51 AM
  2. Error in establishing socket connection
    By saso1310 in forum JDBC
    Replies: 2
    Last Post: 05-18-2009, 01:00 PM
  3. [SOLVED] problem in socket connection
    By neeraj.singh in forum Networking
    Replies: 2
    Last Post: 02-20-2009, 01:33 PM
  4. problem in socket connection in sending images
    By vibhor in forum Networking
    Replies: 2
    Last Post: 02-20-2009, 05:39 AM
  5. How To Make Socket Connection
    By madhumurundi in forum Networking
    Replies: 5
    Last Post: 04-21-2008, 06:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •