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 8014945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:06:07+00:00 2026-06-04T20:06:07+00:00

I am confused: is it possible/advisable to combine threads and select on fd? For

  • 0

I am confused: is it possible/advisable to combine threads and select on fd?
For example: I want to make a threaded tcp client-server program where the client can sent a message to the server and the server spreads this to all connected clients (and the client can continue to communicate).

I made a server-client program where all the clients get a separate thread when connecting; but i read in beej guide “What if you’re blocking on an accept() call? How are you going to recv() data at the same time? “Use non-blocking sockets!” No way! You don’t want to be a CPU hog. What, then?”

I don’t see what blocking means in this case; because in my program when I enter a text and i push enter the text is send to the server but why does he mean by receiving data at the same time? While I am typing the text? How is that possible? I think I am confused :p
Than I think these are completely different ways of tackling the program but than again i don’t see the advantage the select provides?
Thx

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

    It’s certainly possible to use multiple threads that call select, but not necessary. A server can serve all clients with just one thread. How? One at a time. The select function (and its replacements such as poll, epoll, and so on) can notify you when an event occurs on one of the sockets from the set you supply. select will also notify you when a listening socket can accept. So the server can have just one event loop processing both listening and connected sockets.

    As for what the advantages and disadvantages are, I’ll just give you a link to The C10K problem article. This is quite an old debate.

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

Sidebar

Related Questions

I want to implement following functionality but I am confused if it's possible in
Im new to joomla so excuse the possible confused-ness in my part im developing
Possible Duplicate: Confused about C macro expansion and integer arithmetic A riddle (in C)
For a while I am more and more confused because of possible XSS attack
I am very new (and confused) to new relic. Is it possible to install
I confused when i want to take single pointer and when should i take
Possible Duplicate: Malloc thread-safe? I am not a bit confused while I am reading
Possible Duplicate: When is a language considered a scripting language? I am really confused
I somewhat confused because I've read that everything should be possible at IRQL_PASSIVE, but
Possible Duplicate: PHP htmlentities() not working as expected I'm confused as to why it

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.