mardi 28 juin 2022

How do I efficiently select ports in multi process C++ linux servers?

I am using Amazon Gamelift to manage a c++ game server in an Amazon Linux 2 environment. This service will launch multiple instances of the same game server on the same machine at nearly the same time. These processes then report back when they are ready and what port they are bound to. What is the best way to attempt to bind to ports in the same range. For instance, I may choose to use between 1900 and 2100, but I may need 100 processes started up. How do I avoid a ton of collisions as these processes try to all bind to different ports at nearly the same time?

Aucun commentaire:

Enregistrer un commentaire