I am trying to write a programm that communicates with a server over the network. the server implementation is given, i can not change it.

the servers IP address is the 141.47.69.35 and the server aplication listens to port 11111. the server answers to the source port of the request. as a protocoll udp is used. the example code works fine for transmitting data to the server. with a network sniffer i can see that the server responds correcly. but the function readPendingDatagrams() is never called. i gues there is anything wrong with the ports, but i really have no more idea...

Qt Code:
  1. #include "cmyudp.h"
  2. #include "iostream"
  3.  
  4. using namespace std;
  5.  
  6. MyUDP::MyUDP(QObject *parent) : QObject(parent)
  7. {
  8. // initialize port
  9. port = 11111;
  10.  
  11. // create a QUDP socket
  12. udpReceiveSocket = new QUdpSocket(this);
  13.  
  14. // creat host ip
  15. hostIp = new QHostAddress("141.47.69.35");
  16.  
  17. // bind socket
  18. udpReceiveSocket->connectToHost(*hostIp, port, QIODevice::ReadWrite);
  19.  
  20. // setup receiver calllback function
  21. connect(udpReceiveSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()))
  22.  
  23. }
  24.  
  25. void MyUDP::HelloUDP()
  26. {
  27. // create send data
  28. QByteArray Data;
  29. Data.append("Hallo Hilfe!");
  30. udpReceiveSocket->write(Data);
  31. }
  32.  
  33. void MyUDP::readPendingDatagrams()
  34. {
  35. cout << "received!" << endl;
  36. while (udpReceiveSocket->hasPendingDatagrams()) {
  37. cout << "received!" << endl;
  38. }
  39. }
To copy to clipboard, switch view to plain text mode