PDA

View Full Version : QUdpSocket broadcast to multiple processes



tomschuring
29th September 2010, 08:02
The broadcastsender and broadcastreceiver example don't seem to work for me.

if i change the bind in the receiver from:


udpSocket->bind(45454, QUdpSocket::ShareAddress);
to

QHostAddress myAddress = QHostAddress("127.0.0.1");
udpSocket->bindmyAddress, 45454, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);

and the sender from


udpSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress::Broadcast, 45454 );
to

QHostAddress myAddress = QHostAddress("127.0.0.1");
udpSocket->writeDatagram(datagram.data(),datagram.size(), myAddress, 45454 )

it starts to work.
Before i ask my next question, could anyone shed some light on where i could look why this is the case ? From what i read the example should work as is ?

thanks,
tom

tomschuring
30th September 2010, 02:33
found what was the problem.. the firewall was blocking all udp broadcasts.
i figured it out when i temporarily switched off the firewall.

thanks for thinking along all !