31 unsigned int port = 0U ;
32 std::string service_name = in.
service() ;
36 return "silly port number" ;
40 return "invalid port number" ;
45 port = resolveService( in.
service() , udp , error ) ;
53 std::string host_error = resolveHost( in.
host() , port , result ) ;
54 if( !host_error.empty() )
58 return std::string() ;
64 if( pos == std::string::npos || pos == 0U || (pos+1U) == s.length() )
67 host = s.substr(0U,pos) ;
68 service = s.substr(pos+1U) ;
static unsigned int toUInt(const std::string &s, bool limited=false)
Converts string 's' to an unsigned int.
A class that holds a host/service name pair and optionally the results of a name-to-address lookup...
std::string::size_type size_type
A std::size_t type.
static std::string resolve(ResolverInfo &host_and_service, bool udp=false)
Does syncronous name resolution.
static bool isNumeric(const std::string &s, bool allow_minus_sign=false)
Returns true if every character is a decimal digit.
static bool parse(const std::string &in, std::string &host_or_address, std::string &service_or_port)
Parses a string that contains a hostname or ip address plus a server name or port number...
static bool validPort(unsigned int n)
Returns true if the port number is within the valid range.
std::string service() const
Returns the remote service name, as passed in to the constructor.
static bool isUInt(const std::string &s)
Returns true if the string can be converted into an unsigned integer without throwing an exception...
std::string host() const
Returns the remote host name, as passed in to the constructor.