简体   繁体   中英

Determine the sender from a received DatagramPacket in a Multicast group

I am trying to implement a Multicast group in Java whose members can both send and receive DatagramPackets by using MulticastSockets . The sender relies on acknowledgements from the receiving members in order to ensure, say, that all members have received the transmitted file.

My question is whether it is possible for a receiving member to determine the sender of the packet, as all members send and receive packets through the Multicast address they have joined.

This should be possible by assigning each member an ID which will be included (as a sort of preamble) in the first packet of a transmission, but I was wondering whether there is a better solution.

Is any information which could be used to determine the sender stored in the DatagramPacket sent?

Source addresses are always unicast . In other words, transmission of data always begins from a single source. Hence, no matter which node we consider in a network, the packet it gets will have a source MAC address and a destination MAC address (which will be multicast). Using the source MAC address you should be easily able to tell the sender of the packet. I believe you have improperly modeled your problem. Provide us with your UML diagrams/code so that we can analyse it better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM