Receiving Broadcast Datagrams on Multi-Homed Systems
Receiving Broadcast Datagrams on Multi-Homed Systems
- Subject: Receiving Broadcast Datagrams on Multi-Homed Systems
- From: Richard Schmitt <email@hidden>
- Date: Thu, 21 Aug 2008 06:50:38 -0700 (PDT)
I'm having a problem porting one of our sotware packages to OSX/darwin.
It appears that broadcast datagrams can only be recieved on interfaces that have been bound to the ip address INADDR_ANY.
We would prefer not to do that. We do not want to be configured to receive on all interfaces, plus we want a separate socket for each interface that is receiving traffic.
More detail:
- We find the interface addresses of the interfaces we want to listen for UDP datagrams on.
- We open datagram sockets on those interfaces and bind them to the desired port and the ip address of the interface that we want to listen on.
- for instance, let's say we have two interfaces: 10.0.1.5/255.0.0.0 and 192.168.1.2/255.255.255.0 and the application uses port 1000
- we create two datagram sockets and bind one to 10.0.1.5:1000 and the other to 192.168.1.2:1000
When the network clients on submet 10.0.0.0 broadcast to 10.255.255.255 and clients on subnet 192.168.1.0 broadcast to 192.168.1.255, the darwin/osx server application will not receive the packet.
If on the other hand, we bind the sockets with the ip address INADDR_ANY (0.0.0.0) and port 1000, we will receive broadcast traffic from both subnets. Binding to INADDR_ANY is problematic because we have a distinct context for each interface and we need to know which interface packets came in on.
Has anyone else run across this. If so, do you know of a reasonable workaround.
We are trying to make this run on OSX 10.4.11, darwin version 8.11.1
Rich
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden