diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-06-27 04:08:33 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-06-27 04:08:33 +0200 |
commit | 86c1806046dea0bf7c2525d0aa591cdae9b3d330 (patch) | |
tree | ab3091e3f2201489383dc212a2b3b10f93dc5796 /src/madc.cpp | |
parent | f5377412a89b2a7f422decd771dc8de49a5498fc (diff) | |
download | mad-86c1806046dea0bf7c2525d0aa591cdae9b3d330.tar mad-86c1806046dea0bf7c2525d0aa591cdae9b3d330.zip |
Aufwendigere Verarbeitung des Pollings, jetzt auch im Test-Client
Diffstat (limited to 'src/madc.cpp')
-rw-r--r-- | src/madc.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/madc.cpp b/src/madc.cpp index 762429e..8104d0b 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -30,13 +30,21 @@ int main() { try { connection.connect(Mad::Net::IPAddress("127.0.0.1", 6666)); - while(connection.isConnecting()) - connection.sendReceive(); + while(connection.isConnecting()) { + struct pollfd fd = connection.getPollfd(); + + poll(&fd, 1, 10000); + connection.sendReceive(fd.revents); + } connection.send(Mad::Net::Packet(0x0001, 0xABCD)); - while(!connection.sendQueueEmpty()) - connection.sendReceive(); + while(!connection.sendQueueEmpty()) { + struct pollfd fd = connection.getPollfd(); + + poll(&fd, 1, 10000); + connection.sendReceive(fd.revents); + } } catch(Mad::Net::Exception &e) { std::cerr << "Connection error: " << e.what() << std::endl; |