#include #include #include using namespace std; void main() { // Start DarkNet, creating 2 instances mnStart(2,0); // Start servers on both instances mnStartServer(0,50,5,1); mnStartServer(1,50,5,1); // Display information about servers cout << "Server on instance 0:\n"; cout << " Local TCP IP: " << mnGetLocalIPTCP(0) << "\n"; cout << " Local UDP IP: " << mnGetLocalIPUDP(0) << "\n"; cout << " Local TCP Port: " << mnGetLocalPortTCP(0) << "\n"; cout << " Local UDP Port: " << mnGetLocalPortUDP(0) << "\n"; cout << "\n"; cout << "Server on instance 1:\n"; cout << " Local TCP IP: " << mnGetLocalIPTCP(1) << "\n"; cout << " Local UDP IP: " << mnGetLocalIPUDP(1) << "\n"; cout << " Local TCP Port: " << mnGetLocalPortTCP(1) << "\n"; cout << " Local UDP Port: " << mnGetLocalPortUDP(1) << "\n"; cout << "\n\n\n"; bool bRunning = true; while(bRunning == true) { Sleep(1); // Check for new clients on both instances int iJoined; iJoined = mnClientJoined(0); if(iJoined > 0) { cout << "A new client joined server on instance 0\n"; } iJoined = mnClientJoined(1); if(iJoined > 0) { cout << "A new client joined server on instance 1\n"; } // Check for leaving clients on both instances int iLeft; iLeft = mnClientLeft(0); if(iLeft > 0) { cout << "A client left server on instance 0\n"; } iLeft = mnClientLeft(1); if(iLeft > 0) { cout << "A client left server on instance 1\n"; } } // Cleanup mnFinish(-1); }