diff options
Diffstat (limited to 'src/mad-core.cpp')
-rw-r--r-- | src/mad-core.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mad-core.cpp b/src/mad-core.cpp index 5ac0794..04b18cc 100644 --- a/src/mad-core.cpp +++ b/src/mad-core.cpp @@ -21,11 +21,16 @@ #include "Net/IPAddress.h" #include <iostream> + +bool running = true; + void receiveHandler(const Mad::Net::Connection*, const Mad::Net::Packet &packet) { std::cout << "Received packet:" << std::endl; std::cout << " Type: " << packet.getType() << std::endl; std::cout << " Request ID: " << packet.getRequestId() << std::endl; std::cout << " Length: " << packet.getLength() << std::endl; + + running = false; } int main() { @@ -37,7 +42,7 @@ int main() { try { connection.listen(Mad::Net::IPAddress("0.0.0.0", 6666)); - while(!connection.receive()); + while(running) connection.sendreceive(); } catch(Mad::Net::Exception &e) { std::cerr << "Connection error: " << e.what() << std::endl; |