Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Win32 networking & threading

This topic is 5529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lo, At the moment I'm working on my first networking module and I have a question about the usage of threads in such a module. I'm using TCP for this whole thing as I want to guarantee the arrival of the packets. At the moment I have threaded the acceptance function (to accept new connections) and the receive function (to read all sockets). The latter function reads ALL active sockets in the same thread. My question is: would it be wise to create MULTIPLE threads that read the sockets? So, one thread for each socket? I don't want the stuff to block when a client goes tits up. Also, when sending data, do I want to do this in seperate threads? So, one thread for each socket to send data... Thanks for any answers and tips [edited by - Structural on May 26, 2003 3:24:46 AM]

Share this post

Link to post
Share on other sites
How many sockets will your application be using at once?

If you create a new thread for every socket, then you should not be using too many sockets at once, since threads are expensive.

If your application must handle many sockets at once (I would say more than about 20 or 30), then I recommend that you use asynchronous sockets.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!