From 22a091d02cb008dbc14c1809104487fdd62deade Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 10 Aug 2011 19:28:39 +0300 Subject: [PATCH] Create wildcard addresses if * is passed as host --- source/resolve.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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()); -- 2.43.0