From c758482ece08e7b393e343464bf9a2c2d74bf34f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 22 Feb 2015 10:51:16 +0100 Subject: cNetwork: Added EnumLocalIPAddresses() function. --- MCServer/Plugins/NetworkTest/Info.lua | 6 ++++++ MCServer/Plugins/NetworkTest/NetworkTest.lua | 13 +++++++++++++ 2 files changed, 19 insertions(+) (limited to 'MCServer/Plugins/NetworkTest') diff --git a/MCServer/Plugins/NetworkTest/Info.lua b/MCServer/Plugins/NetworkTest/Info.lua index 52422d427..d8c3095fe 100644 --- a/MCServer/Plugins/NetworkTest/Info.lua +++ b/MCServer/Plugins/NetworkTest/Info.lua @@ -50,6 +50,12 @@ g_PluginInfo = }, -- ParameterCombinations }, -- close + ips = + { + HelpString = "Prints all locally available IP addresses", + Handler = HandleConsoleNetIps, + }, -- ips + listen = { HelpString = "Creates a new listening socket on the specified port with the specified service attached to it", diff --git a/MCServer/Plugins/NetworkTest/NetworkTest.lua b/MCServer/Plugins/NetworkTest/NetworkTest.lua index daab0a4bf..22056d4e9 100644 --- a/MCServer/Plugins/NetworkTest/NetworkTest.lua +++ b/MCServer/Plugins/NetworkTest/NetworkTest.lua @@ -288,6 +288,19 @@ end +function HandleConsoleNetIps(a_Split) + local Addresses = cNetwork:EnumLocalIPAddresses() + LOG("IP addresses enumerated, " .. #Addresses .. " found") + for idx, addr in ipairs(Addresses) do + LOG(" IP #" .. idx .. ": " .. addr) + end + return true +end + + + + + function HandleConsoleNetLookup(a_Split) -- Get the name to look up: local Addr = a_Split[3] or "google.com" -- cgit v1.2.3