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

Author Topic: Question about: Socket Selectors and UDP  (Read 2284 times)

0 Members and 1 Guest are viewing this topic.

FleshyOverlord

  • Newbie
  • *
  • Posts: 22
    • View Profile
Question about: Socket Selectors and UDP
« 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?
« Last Edit: June 10, 2018, 11:05:22 pm by FleshyOverlord »

FleshyOverlord

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Question about: Socket Selectors and UDP
« Reply #1 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.

 

anything