SFML community forums

Help => Network => Topic started by: FleshyOverlord on June 07, 2018, 05:14:01 pm

Title: Question about: Socket Selectors and UDP
Post by: FleshyOverlord on June 07, 2018, 05:14:01 pm
I'm currently working on an "Soul Knight" esk (top down shooter) game and I decided to use UDP for networking amongst players. The only problem is I don't know exactly how I should receive packets simultaneously from multiple clients on the server. Right now I have a loop going through a list of all the client IP's and client Ports calling receive commands for each client. For each packet I store a copy of it in a std::vector list. Should I continue to use this method for receivin data or use a socketSelector or some other method?
Title: Re: Question about: Socket Selectors and UDP
Post by: FleshyOverlord on July 15, 2018, 06:27:32 am
After reading the "SFML Essentials" book I realized that the udp socket receive command needs an sf::IpAddress and unsigned int(port number) so that it can write the sender values to the ip and unsigned int. Because of this confusion I thought a receive command would have to be called for every client( udp.receive(packet, clientIP, clientPORT) ) with the client's IP address being the clientIP variable and the client's port number being the clientPORT variable. I now know the receive command writes values to the sf::IpAddress and port instead of reading them. Sorry for the all the confusion.