UDP client multicast : join a group, what address to specify?
http://msdn.microsoft.com/en-us/library/ekd1t784.aspx The JoinMulticastGroup method subscribes the开发者_Python百科 UdpClient to a multicast group using the specified IPAddress.
What address should I specify?
context: I have many computers, which I want to exchange messages between each other by udp multicasting so that one computer sends a message at once to all other members of a certain group.
also, how do I multicast the message using the send routine of udpclient http://msdn.microsoft.com/en-us/library/08h8s12k.aspx ?
While echoing @Vlad's suggestion on general network background, there is sample code in MSDN for the scenario you want here.
The following code example demonstrates how to join a multicast group by providing a multicast address.
Once you have members who have joined the group, any member can call Send
to multicast to all members of the group.
Working through the MSDN docs to understand the sample code and relate it to your own situation should give you all you need to know for simple UDP multicast scenarios.
精彩评论