Hi,
I'm having some troubles setting up a Multicast Client UDP using TRtcUdpClient.
I managed to make the project work with TidUDPClient, but I must use a non-blocking solution for this project.
For this sample, the client must request the server IP address.
The rtc code is :
// Client side Setup
FUDPClient := TRtcUdpClient.New;
FUDPPort := 16283;
FUDPClient.UdpMultiCast := True;
FUDPClient.MultiThreaded := True;
FUDPClient.UdpMultiCastMaxHops := 1;
FUDPClient.ServerAddr := GetBroadcastIP; // returns '192.168.0.255'
FUDPClient.ServerPort := inttostr(FUDPPort);
// Call
if FUDPClient.isConnected then FUDPClient.Disconnect;
FUDPClient.Connect;
try
FUDPClient.Write('? <HOST,PORT>');
Sleep(1000);
finally
FUDPClient.Disconnect;
end;
The Indy code is
var
lAns : String;
lUDPClient : TidUDPClient;
begin
lUDPClient := TidUDPClient.Create;
try
lUDPClient.Port := 16283;
if lUDPClient.Connected then lUDPClient.Disconnect;
try
lUDPClient.Broadcast('? <HOST,PORT>', lUDPClient.Port, GetBroadcastIP );
lAns := lUDPClient.ReceiveString(1000);
finally
Result := length(lAns)<>0;
lUDPClient.Disconnect;
end;
finally
lUDPClient.Free;
end;
It's the same rtcUDPServer for both example. The indy code triggers correctly the server side events.
I'm unable to make rtcUDPClient do the same.
( I also tried using setting the serveraddress to '255.255.255.255'. Indy code works, rtc no joy.. )
What am I missing?
Best regards,
Clément