Re: bsd sockets + selecting network interface
Re: bsd sockets + selecting network interface
- Subject: Re: bsd sockets + selecting network interface
- From: Joe Lake <email@hidden>
- Date: Tue, 16 Dec 2008 03:25:59 +0000 (UTC)
my program discovers a service on using bonjour and then sends udp packets
to it using bsd sockets. I'm using both apple and bsd apis because the
sockets stuff is old code I incorporated into the project to finish it
under deadline.
now my client is running it on a machine with two active network
interfaces. what appears to be happening is a service is discovered via
bonjour over one interface, but when I try to send data to it my socket
sends it out the wrong interface.
so to summarize, my program is running on a computer connected to two
local networks on two interface. it should discover a service being
advertized on one of those networks and transmit data to it. reading
through the bonjour documentation, it looks as though I can easily
determine when interface the advertized service was discovered on. I'd
prefer not to have to port all my network code to a different api, which
is why I'm interested in figuring out how to do this using bsd sockets.
hopefully that clarifies things. thanks for any help you can provide!
Joe
On Mon, 15 Dec 2008, Josh Graessley wrote:
It's not quite that simple. You can select an interface when generating
multicast packets using a socket option. You can bind your socket to an IP
address assigned to a specific interface and all traffic generated by that
socket will have that source address, however that doesn't guarantee that the
traffic will go out the interface that IP address is assigned to.
What are you trying to achieve?
-josh
On Dec 15, 2008, at 5:51 PM, Joe Lake wrote:
hello,
I have an app that uses bsd sockets to do its networking. now my client
wants to run it on a machine with two active network interfaces. I have
heard that it is possible to select which network interface my socket uses
using ioctl().
has anyone done this before on os x? does anyone have any example code?
thanks a lot!
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden