]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/inet.cpp
Add a dynamic receiver class for more flexible packet handling
[libs/net.git] / source / net / inet.cpp
index dbbd12d7e5e7e65cb5292a1c5b04592b29cf4c4f..17546e88dfe62dc6ec2ba273d808c47653a5e1b8 100644 (file)
@@ -1,6 +1,6 @@
 #include "platform_api.h"
-#include <msp/strings/format.h>
 #include "inet.h"
+#include <msp/strings/format.h>
 #include "sockaddr_private.h"
 
 using namespace std;
@@ -16,6 +16,22 @@ InetAddr::InetAddr(const SysAddr &sa)
        port = ntohs(sai.sin_port);
 }
 
+InetAddr InetAddr::wildcard(unsigned port)
+{
+       InetAddr addr;
+       addr.port = port;
+       return addr;
+}
+
+InetAddr InetAddr::localhost(unsigned port)
+{
+       InetAddr addr;
+       addr.addr[0] = 127;
+       addr.addr[3] = 1;
+       addr.port = port;
+       return addr;
+}
+
 SockAddr::SysAddr InetAddr::to_sys() const
 {
        SysAddr sa;