Hello!
I have application containing server and client side. Server broadcasts udp packets on specific port and listen to specific tcp port. Client listens to server's udp packets , process 'em (determine ip address, for example) and connects to server via tcp.

I've wrote udp interaction like this:
Qt Code:
  1. /*server*/
  2. /*initialization*/
  3. QSocketDevice * udp = new QSocketDevice(QSocketDevice::Datagram);
  4. if(!udp->bind(some-address, some-port))
  5. { ... }
  6. #ifdef QTS_WIN32
  7. #elif QTS_LINUX
  8. int one = 1;
  9. setsockopt(udp->socket(), SOL_SOCKET, SO_BROADCAST, &one, sizeof(one));
  10. #endif
  11.  
  12. /*timer loop, 3 sec*/
  13. udp->writeBlock(block, block-length, broadcast-address, some-port);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. /*client*/
  2. /*initialization*/
  3. QSocketDevice * udp = new QSocketDevice(QSocketDevice::Datagram);
  4. if(!udp->bind(some-other-address, some-port))
  5. { ... }
  6. #ifdef QTS_WIN32
  7. #elif QTS_LINUX
  8. int one = 1;
  9. setsockopt(udp->socket(), SOL_SOCKET, SO_BROADCAST, &one, sizeof(one));
  10. #endif
  11.  
  12. QSocketNotifier * udpn = new QSocketNotifier(udp->socket(), QSocketNotifier::Read);
  13. connect( udpn, SIGNAL( activated(int) ), this, SLOT( receiveSomething(int) ) );
  14.  
  15. /*void reciveSomething(int)*/
  16. QByteArray b = udp->readAll();
  17. /*doing something with QString(b)*/
To copy to clipboard, switch view to plain text mode 

It should provide fllowing possibilities:
1. when client starts it can locate and connect to server.
2. when server goes down and then up, clients can to re-locate and re-connect to it

In fact, only possibility (1) works. Each client instance receive only few boradcast packets, despite server sends them all the time.

Why do client cease to receive udp packets?