要看它的源码才知道。
RFC1700中列出了一些特殊的组播地址:
224.0.0.0 Base Address (Reserved) [RFC1112,JBP]
224.0.0.1 All Systems on this Subnet [RFC1112,JBP]
224.0.0.2 All Routers on this Subnet [JBP]
224.0.0.3 Unassigned [JBP]
224.0.0.4 DVMRP Routers [RFC1075,JBP]
224.0.0.5 OSPFIGP OSPFIGP All Routers [RFC1583,JXM1]
224.0.0.6 OSPFIGP OSPFIGP Designated Routers [RFC1583,JXM1]
224.0.0.7 ST Routers [RFC1190,KS14]
224.0.0.8 ST Hosts [RFC1190,KS14]
224.0.0.9 RIP2 Routers [GSM11]
224.0.0.10 IGRP Routers [Dino Farinacci]
224.0.0.11 Mobile-Agents [Bill Simpson]
224.0.0.12-224.0.0.255 Unassigned [JBP]
......
...
//INADDR_ALLHOSTS_GROUP = u_long($e0000001); 即224.0.0.1
// 我没有装Indy,但我估计它这里是这样写的,即加入的组是224.0.0.1 (All Systems on this Subnet),
// 如果你把它改成别的值,如224.1.2.3,就可以令组播地址为224.1.2.3了。当然,你要这样写:ntohl(inet_addr('224.1.2.3'))
mreq.imr_multiaddr.S_addr := INADDR_ALLHOSTS_GROUP; //注意这里,这里就是组播地址。
mreq.imr_interface.S_addr := INADDR_ANY;
if setsockopt(s,IPPROTO_IP,IP_ADD_MEMBERSHIP,pchar(@mreq),sizeof(mreq)) = SOCKET_ERROR then
begin
...
end;