Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-25-2006, 05:06 AM   #1
LQ Newbie
Registered: Mar 2006
Posts: 11

Rep: Reputation: 0
broadcast (udp) socket - multi processes

hi all
I am currently working on an application that spawns several other processes and on all of them I have a udp socket listening for either broadcast messages or direct messages.
I have created a small protocol such that I can address each running process (simple identification) on the same host, so I can either broadcast some messages or send directly to the host. All messages are received by the socket on each processes running on the host but only the ones that have registered for the incoming message will further process the message.

Hope that is quite clear what I'm trying to explain here.

The problem is that when I use direct IP addresses ( instead of the message is not being received to all sockets on the the running processes.
For example:

- Process A spawns -> B
- When a message targeted both for A and B is being sent using direct IP, only the B process receives the message on the udp socket.
- When a message is being sent using broadcast IP all processes are receiving the message on the udp socket.

The sockets are configured using setsockopt() with both SO_REUSEADDR and SO_BROADCAST.

Hope you can assist me in this or give me some hints on where the problem might be.

Old 09-25-2006, 06:06 AM   #2
LQ Newbie
Registered: Mar 2006
Posts: 11

Original Poster
Rep: Reputation: 0
It seems so that the last process being spawned always gets the attention of the socket. Is it so that ports can't be shared when using unicast and only in broadcast cases the ports can be shared?
Is there any way around this other then implementing multicast sockets?



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
Poll() and UDP socket krizzz Programming 4 06-06-2006 10:55 AM
Why Does a Broadcast on a Raw Socket get echoed back to me? btn_paragon Programming 5 09-09-2005 07:32 AM
udp broadcast from one subnet to another thru a linux router siva_bhavani Linux - Networking 1 12-30-2004 10:20 AM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM
how to broadcast UDP datagrams sokar Programming 2 02-14-2004 05:37 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 PM.

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