|
|
@ -464,6 +464,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest |
|
|
|
int port = portDefault; |
|
|
|
int port = portDefault; |
|
|
|
|
|
|
|
|
|
|
|
size_t colon = strDest.find_last_of(':'); |
|
|
|
size_t colon = strDest.find_last_of(':'); |
|
|
|
|
|
|
|
if (colon != strDest.npos) { |
|
|
|
char *endp = NULL; |
|
|
|
char *endp = NULL; |
|
|
|
int n = strtol(pszDest + colon + 1, &endp, 10); |
|
|
|
int n = strtol(pszDest + colon + 1, &endp, 10); |
|
|
|
if (endp && *endp == 0 && n >= 0) { |
|
|
|
if (endp && *endp == 0 && n >= 0) { |
|
|
@ -471,6 +472,7 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest |
|
|
|
if (n > 0 && n < 0x10000) |
|
|
|
if (n > 0 && n < 0x10000) |
|
|
|
port = n; |
|
|
|
port = n; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (strDest[0] == '[' && strDest[strDest.size()-1] == ']') |
|
|
|
if (strDest[0] == '[' && strDest[strDest.size()-1] == ']') |
|
|
|
strDest = strDest.substr(1, strDest.size()-2); |
|
|
|
strDest = strDest.substr(1, strDest.size()-2); |
|
|
|
|
|
|
|
|
|
|
|