You are actually choosing which network to listen to in the first argument of bind function, address. If you are choosing for example QHostAddress::AnyIPv4
it means that no matter from which interface (better to say as a result of which IP address) the packet is received, the program should catch it. Otherwise you can enter an IP address (or a broadcast address) to which the packet should be sent.
For debugging and verification of it you can use netstat
to list open ports as explained here:
https://superuser.com/questions/529830/get-a-list-of-open-ports-in-linux
In the result of netstat command, Local Address
is what you are looking for, specifying which address is being listened to.
NOTE: The address of localhost in Local Address (e.g.: 0.0.0.0 or 127.0.0.1) means any Local Address is acceptable.