38 return std::all_of(s.begin(), s.end(), [](
unsigned char c) {
44 struct servent *se = getservbyname(
"psion",
"tcp");
49 return ntohs(se->s_port);
54 if (host ==
nullptr || port ==
nullptr) {
62 size_t pos = arg.find(
':');
63 if (pos != std::string::npos) {
68 std::string hostComponent = arg.substr(0, pos);
69 std::string portComponent = arg.substr(pos + 1);
74 *host = hostComponent;
75 *port = atoi(portComponent.c_str());
81 *port = atoi(arg.c_str());
bool parse_port(const std::string &arg, std::string *host, int *port)
bool is_number(const std::string &s)
int lookup_default_port()