To enable an arbitrary amount of servers to run, without accidentally tripping on each others ports.
Implementation
Currently, the port number of each server is randomised between two numbers; the odds of clashes are 1/1000.
Instead, we'll do something similar to the Freelance Protocol of ZeroMQ in which the server pings a pre-determined port number - e.g. 6000. If this port is occupied, the server responds with information about itself; such as which host it's running within. Next, it'll ping 6001, then 6002 and so forth until an available port is found.
When an available port number is found, the server listens for future pings from future clients.
Though 1/1000 doesn't seem large, I've already encountered 2-3 occurrences in 3-4 months; which, when multiplied by the amount of potential users of Pyblish is an unacceptable number.
However, the prime purpose is not to enable zero clashes, but to enable a client to ask about available hosts currently running.
By "scanning" port numbers starting at a particular range, we'll be able to visualise running hosts and connect/re-connect running clients on-the-fly.
Goal
To enable an arbitrary amount of servers to run, without accidentally tripping on each others ports.
Implementation
Currently, the port number of each server is randomised between two numbers; the odds of clashes are 1/1000.
Instead, we'll do something similar to the Freelance Protocol of ZeroMQ in which the server pings a pre-determined port number - e.g. 6000. If this port is occupied, the server responds with information about itself; such as which host it's running within. Next, it'll ping 6001, then 6002 and so forth until an available port is found.
When an available port number is found, the server listens for future pings from future clients.
Future
Though 1/1000 doesn't seem large, I've already encountered 2-3 occurrences in 3-4 months; which, when multiplied by the amount of potential users of Pyblish is an unacceptable number.
However, the prime purpose is not to enable zero clashes, but to enable a client to ask about available hosts currently running.
By "scanning" port numbers starting at a particular range, we'll be able to visualise running hosts and connect/re-connect running clients on-the-fly.
Useful.