asterics / AsTeRICS

The Assistive Technology Rapid Integration & Construction Set
http://www.asterics.eu
Other
57 stars 27 forks source link

Deinhofer/resolve port conflicts #335

Closed deinhofer closed 4 years ago

deinhofer commented 4 years ago

This PR automatically resolves port conflicts (ACS or REST ports) in case of multiple ARE instances.

If a port is already busy, try to find another one. The new port is calculated as follows:

int NR_TRIES_PORT=3;
int PORT_STEP_SIZE=5;

for (int i=0;i<NR_TRIES_PORT;i++) {
  int port=port+i*PORT_STEP_SIZE;

  if(bind(port)==true) {
    break;
  }
}

This is done for the old ACS ports (9090, 9091 UDPServer) and REST ports (http=8081,ws=8082,https=8083). Pressing F8 automatically opens the WebACS of the corresponding ARE and opens the model of it.

To know which ARE has which ports, the title of the ARE shows the initial port numbers, e.g. image

ChrisVeigl commented 4 years ago

thanks for adding this functionality! very useful to run multiple ARE-based tools at the same time!

deinhofer commented 4 years ago

thanks for adding this functionality! very useful to run multiple ARE-based tools at the same time!

Thanks!! The error message was really annoying already :-) I will merge now.

klues commented 4 years ago

Great! :) Also very useful for AsTeRICS Grid to have the possibility of multiple instances for input events and performed actions (e.g. environmental control). Are these ports also are configurable by are.properties?

deinhofer commented 4 years ago

Great! :) Also very useful for AsTeRICS Grid to have the possibility of multiple instances for input events and performed actions (e.g. environmental control). Are these ports also are configurable by are.properties?

Yes, the 2 variables can be configured in areProperties