Im trying to write a server/service that broadcasts a message on the lan ever second or so, Kind of like a service discovery.
The message needs to be rece
with the hint from shf301, this is the code i got it to work with
i created a new TIdIPMCastClient
TIdReUseIPMCastClient = class(TIdIPMCastClient)
private
procedure SetReUseAddr(InBinding: TIdSocketHandle; const Value: boolean);
protected
function GetBinding: TIdSocketHandle; override;
public
end;
added the Procedure
procedure TIdReUseIPMCastClient.SetReUseAddr(InBinding: TIdSocketHandle; const Value: boolean);
var
tempi: integer;
begin
if Assigned(InBinding) and InBinding.HandleAllocated then
begin
tempi := iif(Value, 1, 0);
InBinding.SetSockOpt(Id_SOL_SOCKET, Id_SO_REUSEADDR, PChar(@tempi), SizeOf(tempi));
end;
end;
copied the GetBinding code from TIdIPMCastClient, and added the SetReUseAddr before the bind
Bindings[i].AllocateSocket(Id_SOCK_DGRAM);
SetReUseAddr(Bindings[i], True);
Bindings[i].Bind;