I am asking from a programming point of view as I struggle to clearly understand the architecture ex online multiplayer games do when they communicate UDP packets over the internet to thousands/millions of players.
I understand that UDP broadcast and multicast is not easily available when its not internal network but across the internet.
The only other way I can see is that you then manually have to loop through each UDP connection and send the same data to each client ( just as you would if you had a lot of TCP clients ) ? is this true ? I have tried to loop through TCP connections this way and at a certain point things go slow and CPU go high.
if no 1 is the only way, then it would mean that client 1 will get things a lot faster than client number 10000 when it gets to this client in the loop ? are there techniques to get around this in any way ?
since we would have to send the same packet of data to each and every client that of course creates A LOT of network traffic but also it would i assume max out the CPU also if we all the time would have to loop through all clients for each little packet we have to send ?
Please note I am specifically talking about UDP in raw form – not interested in Web-socket versions or ‘use TCP instead’ as its the nature of UDP I am trying to understand here and have been reading all weekend here and while I have a fairly good understanding of the packet level of UDP etc. my network technical knowledge is really not good and it does not tend to stick when I try to read non-programming technical articles about networking/routers/switches/ISP support.
So hoping that someone out there could help me understand it with a programming mindset in mind how something like multiplayer games/VOIP/large IOT networks achieve the ‘real-time’ capabilities of UDP if it has to manually process and send packets onto each UDP sockets.