I've written a simple udp multicast server using QUdpSocket but the writedatagram function only works if I run the app with root privileges. Is this normal? It's a pain. Plus iperf (for example) seems to work without root privileges. What am I doing wrong?
Platform is Ubuntu 12.04 3.2.0-56-generic x86_64 My codes is very simple...
#define MULTICAST_ADDR "192.168.1.255"
#define MULTICAST_PORT 45454
udpSocket = new QUdpSocket();
udpSocket->setSocketOption(QAbstractSocket::MulticastTtlOption,1);
udpSocket->setSocketOption(QAbstractSocket::MulticastLoopbackOption,0);
x = udpSocket->writeDatagram(ba->data()+sent,
toSend,
QHostAddress(MULTICAST_ADDR),
MULTICAST_PORT);
This code is based on QTs own example code which makes no mention of root privileges.
If I simply change the IP address to a non-broadcast/multicast address (e.g. 192.168.1.18) I don't need root privileges.