简体   繁体   中英

UDP sockets not receive multicast messages on the same host

I have two programs.

Program 1. This program creates one socket per network interface, sets the default multicast interface ID for this socket and bind it to the "interface_addr:some_port". Program listens its sockets and process received data.

Program 1 was tested and it receives multicasts from network devices.

Program 2. This program creates one socket per network interface and sends multicast requests and process replies.

Program 2 was tested - it receives replies for multicast requests from network devices.

The problem is that when both programs runned on the one host program 1 not see requests from program 2, but Wireshark shows the packets from program 2.

OS: Windows 7.

What I'm doing wrong?

You don't need multiple sockets. Bind a single socket to INADDR_ANY, and join the group via each interface in turn.

The problem was solved. There is only need to turn on option MULTICAST_LOOP both on the client and server

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