LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to get a multicasting application to work (https://www.linuxquestions.org/questions/programming-9/how-to-get-a-multicasting-application-to-work-680051/)

amolgupta 10-30-2008 12:01 PM

how to get a multicasting application to work
 
hey i wanted to do multicasting i.e. write multicasting application for educational purpose.i even tried to run few codes from different tutorial in c as well as java but thing didn't worked.then i discovered that there are different level of compliance of multicasting capability some say that linux is level 2 compliant and you need to execute some command of "route ***" which i don't understand but i guess has to do with making entries in routing table understand while others say that you will have to recompile your kernel and install mrouted which for me could be a great deal of work.so i just wanted to now what all is required for multicasing over lan and over internet

jf.argentino 10-30-2008 01:15 PM

Nothing special required to do MULTICAST, note that mrouted is only used if you want that your linux box run as a MULTICAST router, nothing to deal with just sending and / or receiving MULTICAST datagrams.

Some tricks:
-you can add the multicast route into the kernel routing rules, but as far as i know it can be a problem only if you have more than interface, or if your default interface isn't configured. That said, you can add it with the following command as root:
Code:

route add -net 224.0.0.0 netmask 240.0.0.0 eth0
, you can replace "eth0" with any other interface you want.

-You can overwrite the system routing rule in your program by specifying the IP address of the interface to use to "listen" to the MULTICAST group when you "setsockopt (IP_ADD_MEMBERSHIP)", and for the emitting interface with a "setsockopt (IP_MULTICAST_IF)". The emitting and receiving interface are totally independant.

-Your MULTICAST emitter doesn't need to make a "setsockopt (IP_ADD_MEMBERSHIP)".

-If the emitter and the receiver run on the same system, you need to loop the MULTICAST socket with a "setsockopt (IP_MULTICAST_LOOP)"

If these don't help, post your code I'll take look.


All times are GMT -5. The time now is 06:31 PM.