LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 02-12-2009, 11:08 AM   #1
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 492

Rep: Reputation: 50
MULTICAST address and port, socket listen only on port?


Hello

I've notice something that I found strange, so if somebody could explain it to me it would be wonderful.

I make an application on GNU/Linux which listening on a MULTICAST stream, so I open my unconnected socket, bind it on a MULTICAST address and a port, join the multicast group with the "setsockopt (IP_ADD_MEMBERSHIP)", then I receive datagram on my socket.

Now I've two different instances of the same application that run with their own MULTICAST address and port. And what I found strange is that, after a misconfiguration, I switch the ports, for example:
Emitting on 225.0.0.1/23451 and 225.0.0.2/23452
Receiving on 225.0.0.1/23452 and 225.0.0.2/23451
And my receiving part doesn't care about the MULTICAST address, it looks like the socket is listening on the port number only! I mean that the receiver [225.0.0.1/23452] take its datagrams from emitter [225.0.0.2/23452] and vice-versa!

I'll try other tests to investigate it but does anybody can explain that thing to me?

Regards.
 
Old 02-14-2009, 02:43 PM   #2
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 876

Rep: Reputation: 184Reputation: 184
You have bug is about the only thing I can think of. A multicast client should only accept multicast packets from groups that it has joined. Any other packets should be dropped.
 
Old 03-09-2009, 01:42 PM   #3
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 492

Original Poster
Rep: Reputation: 50
OK, it looks like I have to join the MULTICAST group with setsockopt (IP_ADD_MEMBERSHIP) _BEFORE_ bind'ing my socket on the port!
Could anybody confirm that.
Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not listen on UDP socket: address is in use. Marv Bon *BSD 10 08-29-2007 01:50 PM
Could not listen on UDP socket: address is in use. Marv Bon *BSD 1 08-26-2007 02:11 PM
Networking:socket ip address and port??? Tricky situations!!! Igor007 Programming 14 11-20-2005 03:26 AM
could not listen on UDP socket: address in use peaceofcrap2001 Linux - Networking 2 07-10-2004 01:18 PM


All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration