Re: sol_socket so_bindtodevice alternative
Re: sol_socket so_bindtodevice alternative
- Subject: Re: sol_socket so_bindtodevice alternative
- From: Hado Hein <email@hidden>
- Date: Mon, 06 Jan 2014 14:53:43 +0100
On 05.01.2014, at 05:30, Ross Bencina <email@hidden> wrote:
> On 5/01/2014 7:43 AM, Hado Hein wrote:
>> I’m trying to find a solution to send udp broadcasts over a specific network interface.
>> Binding to an address is not an option.
>
> Probably I am missing something, but why is binding to an address not an option?
>
> 1. Determine the address of the local adapter you want to send from (there are APIs to enumerate adapters and get their addresses).
>
> 2. Use the local adapter address in sin_addr.s_addr to bind().
>
> Ross.
Hi Ross,
binding to an adress does not influence routing (afaik).
Binding to an address is about receiving only. If i send on a bound socket the ip stack still routes the packet on through the interface that has the gateway.
The situation is:
pdp0 10.x.x.x with gateway
eth0 192.x.x.x without gateway, but with physical/layer 2 reachability for the devices which have 2.x.x.x
Even if i bind to the eth0 ip packets will go out on pdp0 since this one has the gateway. SO_dontroute wasn’t a success also.
thx, Hado.
_______________________________________________
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