I wrote a UPD broadcast test program and broadcast a simple text message.
But I found that the CC3200 wifi didn't response my UDP message and just dropped
that. I did the UDP broadcast by sending packets to IP address 192.168.0.255 and
the used port is 5001. One The CC3200 wifi's IP is 192.168.0.102 and another is 192.168.0.106.
Does anyone have any info on how I would go about this?
I am using C++ Builder XE10.1. My code is the following:
//Sending Broadcast
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIdSocketHandle* SHandle;
IdUDPServer1->Active = false;
IdUDPServer1->Bindings->Clear();
SHandle = IdUDPServer1->Bindings->Add();
SHandle->IP = "192.168.0.100"; //Bound the Indy Server IP
SHandle->Port = 5001;
IdUDPServer1->Active =true;
//Broad
IdUDPServer1->Broadcast("com.pandaos.smartconfig.utils.SCAN_FINISHED" 5001,"192.168.0.255");
}
//Receive UDP Broadcast Response
//---------------------------------------------------------------------------
void __fastcall TForm1::IdUDPServer1UDPRead(TIdUDPListenerThread *AThread, const TIdBytes AData,
TIdSocketHandle *ABinding)
{
String Msg;
try
{
ShowMessage(ABinding->IP);
ShowMessage(ABinding->Port);
Msg = BytesToString(AData);
}
__finally
{
ShowMessage(Msg);
}
}