October 27, 2011

qxoz qxoz
Area 51 Engineer
589 posts

[SOLVED]QUdpSocket & broadcast & Windows7

 

I am sending a request (broadcast: 255.255.255.255) by UDP to determine who is where in the network. The program works fine under WinXP, Ubuntu but under Windows7 sent to any address other than broadcast (255.255.255.255). Other programs written in C # and VB work.

14 replies

October 27, 2011

qxoz qxoz
Area 51 Engineer
589 posts

I then found out that is not sent because the IP is absent. Accordingly, the 255.255.255.255 does not send the same reason. Strange did not UDP should still send?

October 27, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3130 posts

I doubt that 255.255.255.255 is the broadcast address: Those tend to start with the network address.

October 27, 2011

Volker Volker
Robot Herder
5428 posts

The broadcast address is calculated of the network interface address and the netmask. In case your address is 192.168.18.99 and a netmask of 255.255.255.0 (i.e. a /24 net), your broadcast address is 192.168.18.255.

October 28, 2011

qxoz qxoz
Area 51 Engineer
589 posts

Actually, I use the following:
udpSocket->writeDatagram(message,QHostAddress::Broadcast, 161);

October 28, 2011

qxoz qxoz
Area 51 Engineer
589 posts

When I use the address like 192.168.18.255, the network device does not respond.
Respond only for 255.255.255.255 or its own address.

October 28, 2011

Volker Volker
Robot Herder
5428 posts

The actual network address depends on your IP subnet and the netmask. The web has uncountable IP calculators that help you to find out yours.

October 29, 2011

qxoz qxoz
Area 51 Engineer
589 posts

I do not quite understand.
But when I wrote “I use the address like 192.168.18.255” I mean xx.xx.xx.255, where xx.xx.xx is my.

October 29, 2011

Volker Volker
Robot Herder
5428 posts

And you do use a /24 = class C = netmask 255.255.255.0 network?

October 30, 2011

qxoz qxoz
Area 51 Engineer
589 posts

Yes, that’s right

October 30, 2011

qxoz qxoz
Area 51 Engineer
589 posts

I tried to compile with MinGW and VC, result is same .

October 30, 2011

Volker Volker
Robot Herder
5428 posts

Maybe you can post some sample code, so that someone with a Win7 box can try it.

Also make sure that neither a firewall nor a virus or malware scanner is in the way. Additionally you might need to have higher privilges for sending broadcasts, but I’m not sure about this, I might be wrong.

According to QTBUG-13516 [bugreports.qt.nokia.com] there has been an issue with UDP broadcasts on Vista.

November 1, 2011

qxoz qxoz
Area 51 Engineer
589 posts

Well, you can try Broadcasting sender and receiver example from Qt. If receiver and sender on one machine they work but wireshark didnt see the transmit and other computers on network too. If receiver and sender located on different machines nothing happening.

November 4, 2011

qxoz qxoz
Area 51 Engineer
589 posts

I tried using Boost.asio, but the result is same. I can not understand what is the problem. Firewall and antivirus disabled. It’s not a bug of QUdpSocket, can somebody tell where to look next ?

November 18, 2011

qxoz qxoz
Area 51 Engineer
589 posts

I think I understand what the problem was. On computers that I use some older programs are installed and they have changed during installation
several system files. By default, on clean Windows everything is working fine.

 
  ‹‹ problem while saving the graqphics rectitems into a text file      Problem while moving an object to a new thread ››

You must log in to post a reply. Not a member yet? Register here!