Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:26:17+00:00 2026-06-05T19:26:17+00:00

I have created a server in java which accepts client connections. But I am

  • 0

I have created a server in java which accepts client connections. But I am able to only connect one client

class Server extends Thread{

    private void startServer() {

     try{
        ss=new ServerSocket(3000);
        s=ss.accept();
        DataRead d1=new DataRead();        
        d1.t.start();



         }catch(Exception er){
             er.printStackTrace();
         }
        }                                        
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:26:18+00:00Added an answer on June 5, 2026 at 7:26 pm

    You only ever accept one socket. In your jButton1ActionPerformed you have

    s=ss.accept();
    

    But that is only invoked once, when you click the jButton1 button. You need to keep calling accept() to if you want to have multiple clients able to connect.

    Also, keep in mind that each call to accept() will block until a client connects and then return a new socket, representing that connection. So if you want to support multiple client, you shouldn’t have your Socket as a global variable, it should instead be included in the constructor of your DataRead class, so each reader operates on a unique socket/connection/client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a TCP server-client application in java which exchange periodic messages between
I have created a java server, which takes screenshots, resizes them, and sends them
So I'm running a Java server and in one class I have a static
I have a server in Java which is multithreading, and I've created a thread
I have a Java program that creates a server socket and accepts connections from
i have created folder on my server (ie finesse)- 'home' in which i have
I have created an xPages application which uses a lot of server side javascript
I've created a generic 'SocketServer' class in java which takes the following arguments: String
I have about 5 different heterogenous linux dedicated server which can run Java applications.
I have written a Java server for remote storage (an iSCSI Target). The client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.