diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-06-28 15:20:04 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-06-28 15:20:04 +0200 |
commit | ee5c5c9f65556b542ab81942e5a024ba84173762 (patch) | |
tree | 0777270d017dbe986a310e1b33b9b9ebac185634 /src/madc.cpp | |
parent | c0bd49f419b0850085d651a4ceeca45cf9d09832 (diff) | |
download | mad-ee5c5c9f65556b542ab81942e5a024ba84173762.tar mad-ee5c5c9f65556b542ab81942e5a024ba84173762.zip |
Einige Bugs in der Trennung beseitigt.
Diffstat (limited to 'src/madc.cpp')
-rw-r--r-- | src/madc.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
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; } |