multicasting - need a help on multicasting

This is a discussion on multicasting - need a help on multicasting within the Networking/Device Communication forums, part of the General Programming Boards category; Hi All, I im developing some p2p multicasting overlay layer using c. basically what i want to implement is to ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    22

    multicasting - need a help on multicasting

    Hi All,

    I im developing some p2p multicasting overlay layer using c.
    basically what i want to implement is to multicast a string(or any query) from one node wait for a possible response. In the mean time other nodes which have been joined to the muticasting group are listening for multi-casting messages and respose once a message receive.

    my question is how to avoid by receiving a multi-casting message sent by a node itself.
    for eg if node A sent a message "Message from A", in my application node A receive the message "Message from A" itself. I want to avoid that from socket level.

    Can anybody help me with this please?

    Your time is highly appreciated.

    Thanks You.
    Nuwan

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    I don't believe you can do this at the socket level; you may have to filter the messages out at the application level.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    22
    Thanks for the reply.
    If I do it at application level could you give me some tips how to filter its own ip of a peer node.
    I mean a easy way rather I try with it. actualy im in a touch schedule with this project.

    thanks again.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    When you receive the datagram packet, just check the source IP of the sender. If it matches your current IP, then you can discard it. This will work depending on the layout of your network. If NAT occurs before your packet reaches the first multicast aware switch, then the source IP you get back will already be translated so it won't work.

    The easiest way to filter out your own messages is to build it in to the protocol. For instance, your application generates a random GUID when it starts. The application then appends this GUID to every messages it sends out. The application can then drop all messages that have a GUID matching the one it generated on startup.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    395
    my question is how to avoid by receiving a multi-casting message sent by a node itself.
    There is a specific socket option for that (man 7 ip)
    IP_MULTICAST_LOOP
    Sets or reads a boolean integer argument whether sent multicast
    packets should be looped back to the local sockets.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need technical help regarding multicasting
    By wwwnuwan in forum C Programming
    Replies: 1
    Last Post: 03-20-2009, 05:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21