+SockAddr *resolve(const string &str, Family family)
+{
+ string host, serv;
+ if(str[0]=='[')
+ {
+ unsigned bracket = str.find(']');
+ host = str.substr(1, bracket-1);
+ unsigned colon = str.find(':', bracket);
+ if(colon!=string::npos)
+ serv = str.substr(colon+1);
+ }
+ else
+ {
+ unsigned colon = str.find(':');
+ if(colon!=string::npos)
+ {
+ host = str.substr(0, colon);
+ serv = str.substr(colon+1);
+ }
+ else
+ host = str;
+ }
+
+ return resolve(host, serv, family);
+}
+