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
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:It adds the
TIdSocketHandle.IPaddress to the membership of the specified Group IP. IPs can be specified as either IPv4 or IPv6, depending on the setting of theTIdSocketHandle.IPVersionproperty.Alternatively, consider using the
TIdIPMCastServerandTIdIPMCastClientcomponents instead ofTIdUDPServerdirectly.