39 return std::all_of(s.begin(), s.end(), [](
unsigned char c) {
45 struct servent *se = getservbyname(
"psion",
"tcp");
50 return ntohs(se->s_port);
55 if (host ==
nullptr || port ==
nullptr) {
63 size_t pos = arg.find(
':');
64 if (pos != std::string::npos) {
69 std::string hostComponent = arg.substr(0, pos);
70 std::string portComponent = arg.substr(pos + 1);
75 *host = hostComponent;
76 *port = atoi(portComponent.c_str());
82 *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()