Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Basic Threaded Server?  (Read 3967 times)

0 Members and 1 Guest are viewing this topic.

Andershizzle

  • Newbie
  • *
  • Posts: 16
    • View Profile
Basic Threaded Server?
« 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.

phear-

  • Jr. Member
  • **
  • Posts: 64
    • MSN Messenger - LOApokalypse@hotmail.com
    • View Profile
    • http://gtproductions.org
Basic Threaded Server?
« Reply #1 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.
Eugene Alfonso
GTP | Twitter

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Basic Threaded Server?
« Reply #2 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].
Want to play movies in your SFML application? Check out sfeMovie!