Java Server Socket & C++ Client Socket


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Java Server Socket & C++ Client Socket

  1. #1
    Join Date
    May 2004
    Posts
    2

    Java Server Socket & C++ Client Socket

    Hi,
    We have a socket server app in Java and the client application in C++.

    When we try to connect 60 clients simultaneously from C++ using threads, only 55-56 connections are successfull, rest are not connected(Connection refused error).

    For one connection everything works fine. In server side each connection is handled in seperate thread.

    Is there anything else to be done?

    The server code is as follows.
    public class SocketServer
    {
    public static void main(String args[])
    {

    ServerSocket Server = null;
    Socket clientSocket = null;

    try
    {
    Server = new ServerSocket(7999,60);
    }
    catch (IOException e)
    {
    System.out.println(e);
    }

    try
    {
    while (true)
    {
    clientSocket = Server.accept();
    SocketThread objThread = new SocketThread(clientSocket);
    objThread.start();
    }
    }
    catch (Exception e)
    {
    System.out.println(e);
    }
    finally
    {

    try
    {
    Server.close();
    }
    catch (IOException e)
    {
    System.out.println(e);
    }
    }

    }
    }

  2. #2
    Join Date
    May 2004
    Posts
    5
    The number of sockets that can be opened is limited by the operating system where your server runs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center