summaryrefslogblamecommitdiffstats
path: root/tests/Network/EnumInterfaces.cpp
blob: a24158c628f7053c8454f4d5a6afee6eca3e09e1 (plain) (tree)




































                                                                         

// 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;
}