Milo
Milo

Reputation: 51

Packets sent from QUdpSocket are not seen in Wireshark

I'm trying to see my outgoing UDP traffic in Wireshark.

I created new socket and bind it to my QHostAddress::LocalHost with no errors. I then sent some data writeDatagram and the return value is correct, but I see no outgoing traffic in Wireshark.

// create a socket called from init() 
socket = new QUdpSocket(this);
bool ret = socket->bind(QHostAddress::LocalHost, 47000);
if (ret == false)
   {
    printf("failed to bind socket\n");
   }    


// create and sent some data called from send()
QHostAddress addr("192.168.5.12"); // addr of my other computer
qint64 size = socket->writeDatagram(QByteArray("udp data"),addr,47000);

printf("sent %d\n",size); // correct size sent 8

I checked the firewall setting and it's the same result if I turn it off.

Upvotes: 1

Views: 276

Answers (1)

Milo
Milo

Reputation: 51

SOLVED by changing the QHostAddress from localhost to assigned router address.

Upvotes: 1

Related Questions