My environment:
C++ Builder XE4
Indy 10.5.8.3
I am trying to broadcast to network 172.30.58.X with subnet mask 255.255.255.0.
Using TIdUDPClient, I tried following resulting in fail (no response).
// case1
IdUDPClient1->BroadcastEnabled = true;
IdUDPClient1->BroadCast(cmd, port, L"172.30.58.255");
Instead, the following works, but from unlimited network (also including those other than 172.30.58.XXX)
// case2
IdUDPClient1->BroadcastEnabled = true;
IdUDPClient1->BroadCast(cmd, port, L"255.255.255.255");
With the Indy, how can I broadcast only to 172.30.58.XXX?
答案 0 :(得分:1)
在执行访问TIdUDPClient.Binding
属性的任何内容(例如Broadcast()
,Connect()
/ Active
,Send/ReceiveBuffer()
等)之前,请设置{{1连接到TIdUDPClient.BoundIP
网络的本地IP的属性。