1
votes

I have a socket bound to a port 1900 to listen to multicast packets. This part works well. I successfully receive multicast packets.

Also I'm using the same socket to send multicast packets to the same port 1900. On response I expect to receive an unicast packet. According to Wireshark the unicast packet is received by my host, but it doesn't appear in the socket.

If I remove binding to port 1900 then the unicast packet appears in the socket, but in this case multicast packets aren't received by the socket anymore.

I checked, joining a multicast group has nothing with it. Even a simple test app which binds to port 1900 and sends multicast to port 1900 can't receive unicast response.

Is the main problem using the same source and target ports? Or does sending multicast packets from a specific port prevent the socket from getting unicast packets to the same port?

1
Could you show the code for your socket() and bind() calls?bjornruffians
I have the same issue as yours on Windows. Have you resolved this problem?Jruv
I solved the problem by using two sockets. One is used to listen to multicast packets and another one is used to send multicast requests and receive unicast responsesrkudinov

1 Answers

1
votes

I encountered this issue on the windows7 yesterday and figured out the root cause. Suppose you're doing a SSDP MSearch, receive the response, and listen to the SSDP notification.

  1. Start -> Run -> services.msc
  2. Check the service "SSDP discovery". It should be in status "Started"

The UNICAST response are eaten by this service and can never reach your socket.

Solution 1:

You don't need change your code, just stop the SSDP discovery service. Everything should be okay.

Solution 2: Don't need stop the SSDP discovery service. But you need two sockets:

  • Socket 1: bind to the port 0 or port other than 1900. Send multicast and receive unicast response from this socket.
  • Socket 2: bind to the port 1900, listen multicast notification only