SFML community forums

Help => Network => Topic started by: Andershizzle on September 06, 2009, 08:23:02 pm

Title: Basic Threaded Server?
Post by: Andershizzle on September 06, 2009, 08:23:02 pm
Hey can anyone give me some pointers on how to go about making a threaded server with C++ / SFML? I made one in Ruby a loong time ago and I'm kindof stuck I'm not sure what to do.

Hell, even if someone could write a basic server code for me that'd be good (listens, starts new thread for each client)

Or even write a tutorial on how to do it for the Tutorials section of the site ^^

When I do get this all figured out I'll write a tutorial here unless someone else does.
Title: Basic Threaded Server?
Post by: phear- on September 06, 2009, 08:50:08 pm
Starting a new thread for each client will waste a TON of resources. I haven't used the network library yet but im assuming its using asynchronous sockets which means you could setup a thread pool and when stuff is recieved send it off to an unused thread.
Title: Basic Threaded Server?
Post by: Ceylo on September 07, 2009, 05:59:15 pm
Quote from: "phear-"
Starting a new thread for each client will waste a TON of resources. I haven't used the network library yet but im assuming its using asynchronous sockets which means you could setup a thread pool and when stuff is recieved send it off to an unused thread.

Yup, with sf::Selector[TCP|UDP].