Question

Maybe the solution to this is very simple and I'm just too dumb to see it. I need to recompile an old application with Indy 10 and there's this line that used to be

inUDPServer.Binding.SetSockOpt(Id_IPPROTO_IP, Id_IP_ADD_MEMBERSHIP, PChar(@mreq), SizeOf(mreq));

but the new TIdSocketHandle.SetSockOpt takes 3 integers. Now how am I supposed to provide the ip_mreq? Just passing the imr_multiaddr.S_addr results in an #10014 Error - Buffer fault. Maybe one of you guys has an idea.

Cheers Andy

Was it helpful?

Solution

Use the TIdSocketHandle.AddMulticastMembership() method instead (if your version of Indy 10 does not have that method available, then you will have to update to a newer snapshot first), eg:

inUDPServer.Binding.AddMulticastMembership('Group IP address');

It adds the TIdSocketHandle.IP address to the membership of the specified Group IP. IPs can be specified as either IPv4 or IPv6, depending on the setting of the TIdSocketHandle.IPVersion property.

Alternatively, consider using the TIdIPMCastServer and TIdIPMCastClient components instead of TIdUDPServer directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top