Assuming the behavior is that it connects on loopback? You did not specify the behavior you are seeing. Best guess is that your platform's getaddrinfo() implementation treats an empty "node" argument the same way it would treat a NULL, which means the address returned is suitable for local connections.
Also, you don't need to convert ipAddress to c_str() if it is already a std::string. The constructor takes a const string ref, so this conversion to c_str() is totally unnecessary. - Jim
