using namespace boost;
using std::endl;
- struct addrinfo hints;
- struct addrinfo *res;
-
regex expr("(tcp|rdma)://([^:]*):([\\d]+)");
cmatch m;
if (regex_match(url, m, expr)) {
- int error;
string host(m[2].first, m[2].second);
string port(m[3].first, m[3].second);
+ addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
- error = getaddrinfo(host.c_str(), NULL, &hints, &res);
+ addrinfo *res;
+ int error = getaddrinfo(host.c_str(), NULL, &hints, &res);
if (! error) {
addr->set_sockaddr((sockaddr*)res->ai_addr);
addr->set_port(std::atoi(port.c_str()));