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

  • Home
  • SEARCH
  • 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 8301091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:48:57+00:00 2026-06-08T16:48:57+00:00

I am developing a group chat application to learn how to use sockets, threads

  • 0

I am developing a group chat application to learn how to use sockets, threads (maybe), and asycore module(maybe).
What my thought was have a client-server architecture so that when a client connects to the server the server sends the client a list of other connects (other client ‘user name’, ip addres) and then a person can connect to one or more people at a time and the server would set up a P2P connection between the client(s). I have the socket part working, but the server can only handle one client connection at a time.
What would be the best, most common, practical way to go about handling multiple connections?
Do I create a new process/thread whenever I new connection comes into the server and then connect the different client connections together, or use the asycore module which from what I understand makes the server send the same data to multiple sockets(connection) and I just have to regulate where the data goes.

Any help/thoughts/advice would be appreciated.

  • 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-08T16:48:59+00:00Added an answer on June 8, 2026 at 4:48 pm

    For a group chat application, the general approach will be:

    Server side (accept process):

    • Create the socket, bind it to a well known port (and on appropriate interface) and listen
    • While (app_running)
      • Client_socket = accept (using serverSocket)
      • Spawn a new thread and pass this socket to the thread. That thread handles the client that just connected.
      • Continue, so that server can continue to accept more connections.

    Server-side client mgmt Thread:

    • while app_running:
      • read the incoming message, and store to a queue or something.
      • continue

    Server side (group chat processing):

    • For all connected clients:
      • check their queues. If any message present, send that to ALL the connected clients (including the client that sent this message — serves as ACK sort of)

    Client side:

    • create a socket
    • connect to server via IP-address, and port
    • do send/receive.

    There can be lots of improvement on the above. Like the server could poll the sockets or use “select” operation on a group of sockets. That would make it efficient in the sense that having a separate thread for each connected client will be an overdose when there are many. (Think ~1MB per thread for stack).

    PS: I haven’t really used asyncore module. But I am just guessing that you would notice some performance improvement when you have lots of connected clients and very less processing.

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

Sidebar

Related Questions

I am developing an android project in which I have to load from group
Developing for Android 2.3, I have a question regarding layouts. I use a vertival
While developing an application using gwt in ecliplse crashed. Now the server is running
I have been happily developing my application locally and using sqlite3 as database only
I am developing an application in struts 2 and hibernate 3. I have 3
My group is developing a service-based (.NET WCF) application and we're trying to decide
I'm developing a timesheet application using SQL Server as my backend and I am
I'm developing a WinForms application and on one form, I use a GroupBox to
I am developing a new module for a large Application in Delphi 2010. I
Developing a project of mine I realize I have a need for some level

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.