Bernd  Jacobi
Bernd Jacobi

Reputation: 581

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?

Upvotes: 0

Views: 696

Answers (2)

Bernd  Jacobi
Bernd Jacobi

Reputation: 581

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

Upvotes: 1

user207421
user207421

Reputation: 311050

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

Upvotes: 1

Related Questions