SFML community forums

Help => Network => Topic started by: rgrant1993 on August 03, 2013, 08:32:31 pm

Title: Multiple clients
Post by: rgrant1993 on August 03, 2013, 08:32:31 pm
I have found a tutorial on how to do multiple clients with SFML, but even i can see that the developer was lost in their own code. :)

I have crossed SFML documentation stating how to connect to multiple clients, but i strongly believe that it was for a earlier version of SFML. So how can we implement several clients to a server?
Title: Re: Multiple clients
Post by: rgrant1993 on August 03, 2013, 08:38:57 pm
I suppose this would also be known as socket selectors?
Title: Re: Multiple clients
Post by: ahnonay on August 03, 2013, 10:39:26 pm
Yes, you can use SocketSelectors to read from multiple clients at once, but you don't have to. They just make things easier.
The documentation provides example code:
http://www.sfml-dev.org/documentation/2.1/classsf_1_1SocketSelector.php
Alternatively, you could just store your client sockets in a list and call receive on each of them.