DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links