#include #include using namespace std; void main() { // Load the DarkNet networking module mnStart(1,0); // Start server mnStartServer(0,50,0,3); // Display information about server 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'; // Create packet to store received data long long int RecvPacket = mnCreatePacket(); bool bRunning = true; while(bRunning == true) { // Check for new clients int iJoined = mnClientJoined(0); if (iJoined > 0) { cout << "A new client joined the server\n"; } // Check for leaving clients int iLeft = mnClientLeft(0); if(iLeft > 0) { cout << "A client left the server\n"; } for(int cl = 1; cl 0) { cout << "UDP data received\n"; } // Check for new TCP data int iTCP = mnRecvTCP(0,RecvPacket,cl); if(iTCP > 0) { cout << "TCP data received\n"; } } } // Cleanup mnFinish(-1); }