I was trying to find a solution to send a udp broadcast out a specific nic on a system with multiple devices.
The problem is simply that if you have more than one nic
eg:
192.168.0.3 and 10.1.1.3
The broadcast will report the first address regardless which may not be the default device.
I didn't find any socket option solution to the problem, though I have at least found a solution that may work, I just don't know if it would hold.
Is it safe to assume that the default gateway is the same range as the default device?
eg: if I enumerate the devices to get their IP's and gateway
I get a list like this
IP = 192.168.0.3
gateway =
IP = 10.1.1.3
gateway = 10.1.1.1
UDP Broadcast on a specific nic
In command prompt "Route Print" will show you which traffic will go where, "Route Add" will add a temporary or persistant route (persistant stays after a reboot).
Route /? will give you the details of how to use them.
We use these things when we have a windows machine as a proxy between local network and a DMZ (with another firewall on the outside of that) and the server has a foot (nic) in each subnet.
One direction has to be default and hold the 0.0.0.0 then static routes of any size can have a next hop on an IP of a gateway in the subnet of one of the nics
It's a little confusing first time you use it but not too bad once you play with it a bit.
if you want some help with structuring the commands post (or PM) me the IPs, subnets, Gateways and the contents of "Route Print"
Route /? will give you the details of how to use them.
We use these things when we have a windows machine as a proxy between local network and a DMZ (with another firewall on the outside of that) and the server has a foot (nic) in each subnet.
One direction has to be default and hold the 0.0.0.0 then static routes of any size can have a next hop on an IP of a gateway in the subnet of one of the nics
It's a little confusing first time you use it but not too bad once you play with it a bit.
if you want some help with structuring the commands post (or PM) me the IPs, subnets, Gateways and the contents of "Route Print"
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Thanks, the solution I've got is working on my network but I just don't know if my logic is right or if it will hold for more complex networks.
When I send the broadcast it's sent out on all the interfaces but the problem is that it only reports the IP of the first interface and not the second.
So when a listening client gets the broadcast, the IP of the sender is still resolved as the first interface, which may not be the interface that the actual server application is listening on.
As long as the client and server are not separated by a router the Limited Broadcast will reach all the machines on the LAN.
As long as the default gateway is the same subnet that the Server application is listening on then, it's all good otherwise I need to find another solution.
When I send the broadcast it's sent out on all the interfaces but the problem is that it only reports the IP of the first interface and not the second.
So when a listening client gets the broadcast, the IP of the sender is still resolved as the first interface, which may not be the interface that the actual server application is listening on.
As long as the client and server are not separated by a router the Limited Broadcast will reach all the machines on the LAN.
As long as the default gateway is the same subnet that the Server application is listening on then, it's all good otherwise I need to find another solution.
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
I still have no idea what the target is 
Standard broadcasts will be seen and read by all NICs and forwarded to the IP layer. Depending on what is inside the IP layer, the end device will answer or not.
That means, if a broadcast ping will be sent, the ICMP echo request won't be answered on certain OSs (or if a firewall does not allow this protocol etc.)
So if a client will uses a protocol (Purebasic program) which answers to your request, you will get not only one reply (if your sending device waits for multiple answers
)
Michael

Standard broadcasts will be seen and read by all NICs and forwarded to the IP layer. Depending on what is inside the IP layer, the end device will answer or not.
That means, if a broadcast ping will be sent, the ICMP echo request won't be answered on certain OSs (or if a firewall does not allow this protocol etc.)
So if a client will uses a protocol (Purebasic program) which answers to your request, you will get not only one reply (if your sending device waits for multiple answers

Michael