socket.addSourceSpecificMembership(sourceAddress, groupAddress[, multicastInterface])


告诉内核在给定的 sourceAddressgroupAddress 上加入特定于源的多播频道,使用 multicastInterfaceIP_ADD_SOURCE_MEMBERSHIP 套接字选项。 如果未指定 multicastInterface 参数,则操作系统将选择一个接口并为其添加成员资格。 要为每个可用接口添加成员资格,则多次调用 socket.addSourceSpecificMembership(),每个接口一次。

当在未绑定的套接字上调用时,则此方法将隐式地绑定到随机端口,监听所有接口。

Tells the kernel to join a source-specific multicast channel at the given sourceAddress and groupAddress, using the multicastInterface with the IP_ADD_SOURCE_MEMBERSHIP socket option. If the multicastInterface argument is not specified, the operating system will choose one interface and will add membership to it. To add membership to every available interface, call socket.addSourceSpecificMembership() multiple times, once per interface.

When called on an unbound socket, this method will implicitly bind to a random port, listening on all interfaces.