From 86c1806046dea0bf7c2525d0aa591cdae9b3d330 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 27 Jun 2008 04:08:33 +0200 Subject: Aufwendigere Verarbeitung des Pollings, jetzt auch im Test-Client --- src/madc.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/madc.cpp') 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; -- cgit v1.2.3