summaryrefslogtreecommitdiffstats
path: root/src/madc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/madc.cpp')
-rw-r--r--src/madc.cpp16
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;