문제

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:

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top