mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
703rc/fix port size (#802)
* validate port numbers in client * validate port numbers created at virtual servers and receiver process as tcp ports
This commit is contained in:
@ -203,4 +203,13 @@ MacAddr InterfaceNameToMac(const std::string &inf) {
|
||||
return MacAddr(mac);
|
||||
}
|
||||
|
||||
void validatePortNumber(int port) {
|
||||
if (0 >= port || port > std::numeric_limits<uint16_t>::max()) {
|
||||
std::ostringstream oss;
|
||||
oss << "Invalid port number " << port << ". It must be in range 1 - "
|
||||
<< std::numeric_limits<uint16_t>::max();
|
||||
throw RuntimeError(oss.str());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
Reference in New Issue
Block a user