summaryrefslogtreecommitdiffstats
path: root/tests/Network/EnumInterfaces.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-03-13 18:12:33 +0100
committerMattes D <github@xoft.cz>2016-06-18 13:12:06 +0200
commit3184433756c6014e5192bdb92df9a233c62b55e7 (patch)
treeac1876080548ea7e18d327ac204ad0ba1f0c034b /tests/Network/EnumInterfaces.cpp
parentMerge pull request #3224 from QUSpilPrgm/master (diff)
downloadcuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar.gz
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar.bz2
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar.lz
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar.xz
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.tar.zst
cuberite-3184433756c6014e5192bdb92df9a233c62b55e7.zip
Diffstat (limited to '')
-rw-r--r--tests/Network/EnumInterfaces.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/Network/EnumInterfaces.cpp b/tests/Network/EnumInterfaces.cpp
new file mode 100644
index 000000000..a24158c62
--- /dev/null
+++ b/tests/Network/EnumInterfaces.cpp
@@ -0,0 +1,37 @@
+
+// EnumInterfaces.cpp
+
+// Implements the main app entrypoint for the EnumInterfaces network test
+// Lists all network interfaces to the console
+
+#include "Globals.h"
+#include "OSSupport/Network.h"
+#include "OSSupport/NetworkSingleton.h"
+
+
+
+
+
+int main(int argc, char * argv[])
+{
+ // Initialize the cNetwork subsystem:
+ cNetworkSingleton::Get().Initialise();
+
+ // Enumerate all the addresses:
+ printf("Enumerating all IP addresses...\n");
+ auto IPs = cNetwork::EnumLocalIPAddresses();
+ for (auto & ip: IPs)
+ {
+ printf(" %s\n", ip.c_str());
+ }
+ printf("Done.\n");
+
+ // Terminate the cNetwork subsystem:
+ cNetworkSingleton::Get().Terminate();
+
+ return 0;
+}
+
+
+
+