问题
I want test the Multicast functionality in my NIC Manually. I found a tool to generate the multicast traffic using Mint tool, I installed it and now I want add my host to Multicast Group how to do that can anyone suggest me or other way to test the Multicast Functionality. Thanks in Advance.
回答1:
Create a UDP socket, bind it to the multicast group and teh port number on which you would send the multicast traffic. Next, set multicast IP_ADD_MEMBERSHIP and pass the group number. Once these steps are done, you can call recvfrom() for that fd and you should be able to receive the packets. You might find this useful: http://www.cs.unc.edu/~jeffay/dirt/FAQ/comp249-001-F99/mcast-socket.html
来源:https://stackoverflow.com/questions/18503464/how-to-add-my-host-to-multicast-group