From: Mikko Rasa Date: Wed, 10 Aug 2011 16:28:39 +0000 (+0300) Subject: Create wildcard addresses if * is passed as host X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=22a091d02cb008dbc14c1809104487fdd62deade;p=libs%2Fnet.git Create wildcard addresses if * is passed as host --- diff --git a/source/resolve.cpp b/source/resolve.cpp index 8afe0fe..6e17a1a 100644 --- a/source/resolve.cpp +++ b/source/resolve.cpp @@ -38,7 +38,14 @@ SockAddr *resolve(const string &s, Family family) host = s; } - addrinfo hints = { 0, family_to_sys(family), 0, 0, 0, 0, 0, 0 }; + unsigned flags = 0; + if(host=="*") + { + flags = AI_PASSIVE; + host = string(); + } + + addrinfo hints = { flags, family_to_sys(family), 0, 0, 0, 0, 0, 0 }; addrinfo *res; const char *chost = (host.empty() ? 0 : host.c_str()); const char *cserv = (serv.empty() ? 0 : serv.c_str());