]> git.tdb.fi Git - libs/net.git/commitdiff
Change listen address construction
authorMikko Rasa <tdb@tdb.fi>
Wed, 10 Aug 2011 18:07:08 +0000 (21:07 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 10 Aug 2011 18:07:08 +0000 (21:07 +0300)
source/server.cpp

index 259d13b087598d5ae602f1c4b16e7ec6ed24259e..9205cc1096383caa797f1af237ec9e02e1b07724 100644 (file)
@@ -1,7 +1,9 @@
 #include <exception>
 #include <msp/core/refptr.h>
 #include <msp/net/inet.h>
+#include <msp/net/resolve.h>
 #include <msp/net/streamsocket.h>
+#include <msp/strings/format.h>
 #include "request.h"
 #include "response.h"
 #include "server.h"
@@ -16,7 +18,8 @@ Server::Server(unsigned port):
        event_disp(0)
 {
        sock.signal_data_available.connect(sigc::mem_fun(this, &Server::data_available));
-       sock.listen(Net::InetAddr(0, port), 8);
+       RefPtr<Net::SockAddr> addr = Net::resolve("*", format("%d", port));
+       sock.listen(*addr, 8);
 }
 
 unsigned Server::get_port() const