enh(io): use igtl::serverSocket to get real port number
Description
When starting an igtlNetwork::Server
we store the port number in m_port
by doing m_port = port
, but this can be wrong if port = 0
and thus the socket automatically looks for an available port number.
Proposal
replace line 143 igtlNetwork/Server.cpp
- m_port = port
+ // Ask m_serverSocket to give us the real port number (ex: if port i 0, it will use the first available port).
+ m_port = m_serverSocket->GetServerPort();
(How you will do it)
Outcomes
This allow us to use 0
as port number, and let socket decide which port to use. We can then safely get the port number.