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 copy to clipboard, switch view to plain text mode
to
QHostAddress myAddress = QHostAddress("127.0.0.1");
udpSocket->bindmyAddress, 45454, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
To copy to clipboard, switch view to plain text mode
and the sender from
udpSocket
->writeDatagram
(datagram.
data(),datagram.
size(),
QHostAddress::Broadcast,
45454 );
udpSocket->writeDatagram(datagram.data(),datagram.size(), QHostAddress::Broadcast, 45454 );
To copy to clipboard, switch view to plain text mode
to
udpSocket->writeDatagram(datagram.data(),datagram.size(), myAddress, 45454 )
QHostAddress myAddress = QHostAddress("127.0.0.1");
udpSocket->writeDatagram(datagram.data(),datagram.size(), myAddress, 45454 )
To copy to clipboard, switch view to plain text mode
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
Bookmarks