The rand() call after srand(time(NULL)) always results in 0, which means that the static API always binds itself to the port 6000. Removing the srand causes the port 18585 to be always used, so in the end I can think of 2 options:
a) assume that the application has to srand with a seed and move the responsibility to the application
b) abstract the call for srand and implement seeding on every platform.
The rand() call after srand(time(NULL)) always results in 0, which means that the static API always binds itself to the port 6000. Removing the srand causes the port 18585 to be always used, so in the end I can think of 2 options:
a) assume that the application has to srand with a seed and move the responsibility to the application b) abstract the call for srand and implement seeding on every platform.