title: cannot read from QUdpSocket client
body: <p>I send command to a system and read response from it. My machine is client, I write a packet successfully to server, however, I cannot receive the response from it. I am wondering why this happens, please have a look at my code: (server address is 192.168.100.143 and the port is 11000)</p>
  
  <pre><code>void UDP::UDPInit(int port)
  {
      socketPort = port;
  
      udpsocket = new QUdpSocket(this);
  }
  
  
  void UDP::sendCommand(QByteArray data)
  {
      QHostAddress *host  = new QHostAddress("192.168.100.143");
      quint16 port = 11000;
      if(udpsocket-&gt;writeDatagram(data.data(),QHostAddress(ip),socketPort)==-1)
          emit clientLogMessage(QString("UDPCLIENT : Write problem !"));
      else
          udpsocket-&gt;flush();
  
      while (!udpsocket-&gt;hasPendingDatagrams()) {
           QByteArray datagram;
           datagram.resize(udpsocket-&gt;pendingDatagramSize());
           qDebug() &lt;&lt; udpsocket-&gt;pendingDatagramSize();
           udpsocket-&gt;readDatagram(datagram.data(), datagram.size(), host, &amp;port);
           emit dataReceived(datagram);
       }
  }
  </code></pre>