Packets are not delivered to multicasting group RRS feed

  • Question

  • I am facing one strange problem related to multicasting. Please find the scenario of my problem as follows, it would be really great help if anybody can pin point my mistake:

    I have a Windows XP 64-bit machine with 3 network interfaces, I created one multicasting group which has IP address:port as :6543 and added all 3 network interfaces into the multitasking group. But when I send a UDP message to one of the interface on port 6543, the message is not delivered to the process but I can see with the help of wireshark tool that the message is reaching the machine on which above process is running.

    I implemented above program in C++ which doesn’t work but the similar program in python does work. The sample code is:

    #! /usr/bin/python


    import socket

    import struct

    import sys


    #Server part

    if sys.argv[1] == 'server':

        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)

        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

        sock.bind(('', 6543))

        mreq = struct.pack('4sl', socket.inet_aton(''), socket.INADDR_ANY)


        sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)


        while True:

            print sock.recv(10240)



    #client part to deliver a message


        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)

        sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 5)

        sock.sendto(sys.argv[2], ('', 6543))



    Can you please let me know if I am missing anything?

    Tuesday, July 13, 2010 11:00 PM

All replies

  • I figured out the issue, I was having two processes waiting on multicast group, but I was sending the unicast message and only one of them used to receive it.

    Is there a way to send unicast message to multiple processes waiting on same address and port?

    Wednesday, July 14, 2010 8:13 PM