From ee5c5c9f65556b542ab81942e5a024ba84173762 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Jun 2008 15:20:04 +0200 Subject: Einige Bugs in der Trennung beseitigt. --- src/madc.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/madc.cpp') diff --git a/src/madc.cpp b/src/madc.cpp index 08fb3b3..790baf5 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -24,34 +24,34 @@ int main() { Mad::Net::Connection::init(); - + Mad::Net::ClientConnection connection; - + try { connection.connect(Mad::Net::IPAddress("127.0.0.1", 6666)); - + while(connection.isConnecting()) { struct pollfd fd = connection.getPollfd(); - + if(poll(&fd, 1, 10000) > 0) connection.sendReceive(fd.revents); } - + connection.send(Mad::Net::Packet(Mad::Net::Packet::TYPE_DEBUG, 0x1234)); connection.send(Mad::Net::Packet(Mad::Net::Packet::TYPE_DISCONNECT_REQ, 0xABCD)); - + while(!connection.sendQueueEmpty()) { struct pollfd fd = connection.getPollfd(); - + if(poll(&fd, 1, 10000) > 0) connection.sendReceive(fd.revents); } - + connection.disconnect(); - + while(connection.isConnected()) { struct pollfd fd = connection.getPollfd(); - + if(poll(&fd, 1, 10000) > 0) connection.sendReceive(fd.revents); } @@ -59,10 +59,8 @@ int main() { catch(Mad::Net::Exception &e) { std::cerr << "Connection error: " << e.what() << std::endl; } - - connection.disconnect(); - + Mad::Net::Connection::deinit(); - + return 0; } -- cgit v1.2.3