pSpaces / jSpace

Programming with Spaces in Java
MIT License
17 stars 13 forks source link

Add a way for a ServerGate to chose its own port #18

Open TheAIBot opened 6 years ago

TheAIBot commented 6 years ago

It's currently not feasible to have more than one instance of your jSpace program open because there is really no other way to handle creating a ServerGate than to hardcode the port.

So i would really like to be able to do something like this:

SpaceRepository rep = new SpaceRepository();
final int portUsed = rep.addGate("tcp://127.0.0.1:/?conn");

To add a gate without a specific port in mind, the port is simply omitted from the URI. addGate would then have to be changed to return the port that the socket chose to use. How the port is then transfered to the RemoteSpace is still a hassle but another issue will tackle that problem.

albertolluch commented 6 years ago

yes, also this feature is interesting, good point @TheAIBot . We will keep it in mind.