Re: How to set interface for Multicast server ?
Kevin,
About a month or so ago I suggested an approach that *should* be
portable. (If by portable you mean cross-OS, this *should* work. It is
using plain vanilla standard socket API. I haven't done windoze
programming in a long time, but I think it is all there...)
...here's a link to the posting
http://archive.ncsa.uiuc.edu/lists/iperf-users/jan04/msg00003.html
In a nutshell, I suggested using the -B and -c/-s flags in a consistent
way whether in client or server mode --- that is, if you want to bind to a
specific interface address, use -B (client or server mode). If you want to
specify exactly which pkts to receive based on their dest addr, use the -c
or -s flag. The arg following -s could still be optional to receive pkts
of any ipaddr.
The combination of interface address, multicast address, and port can be
used as the arguments to both join the multicast group (mcast addr, iface
addr) and bind the socket to receive only packets addressed to mcast addr
and port that come in on the specified iface addr.
(Check out UNIX Network Programming Vol. 1 by Richard Stevens. It is an
excellent resource and is a must-have for anyone doing any kind of real
network programming. Some regard it as the "bible" for network
programming.)
Jim
Kevin Gibbs wrote:
>
> This has been an on going concern that has been voiced by many. Does any
> one know of a way to portably support this feature? Normally to bind to a
> specific NIC you use -B nic which results in a bind() call with that
> address. However when you do a -B multicast-address that also results in a
> bind() call but since it specifies a multicast address that is a valid
> address on all NICs so that is what you get. Any insights? This feature
> would not be difficult to add if I knew that it was possible and portable.
>
> Kevin
>
> On Thu, 26 Feb 2004, Jim Kaba wrote:
>
> > Jacob,
> > If I understand your question correctly, I think I ran into the same
> > problem a few weeks back---i.e. there is currently not a good way to bind
> > the iperf server to a multicast address on a specific network interface on
> > machines that have more than one interface.
> >
> > ...the way I got around it was to create a static route whenever I needed
> > to do it:
> >
> > route add 224.0.67.67 dev eth1 (this is assuming that "eth1" is the
> > network device corresponding to the network interface whose hostname is
> > "node2")
> >
> >
> > ...by default mcast routes will be associated with an interface the kernel
> > picks (usually the first to come up).
> >
> >
> > Jim
> >
> >
> > Jacob Teplitsky wrote:
> > >
> > > Hi,
> > > Is therte a way to bind a server to an interface:
> > >
> > > node5> iperf -s -u -B 224.0.67.67 -i 1
> > > ------------------------------------------------------------
> > > Server listening on UDP port 5001
> > > Binding to local address 224.0.67.67
> > > Joining multicast group 224.0.67.67
> > > Receiving 1470 byte datagrams
> > > UDP buffer size: 32.0 KByte (default)
> > >
> > > I how it can be done for the client:
> > >
> > > /usr/local/bin/iperf -c 224.0.67.67 -u --ttl 5 -t 5 -B node2
> > >
> > > Thanks
> > > - Jacob
> >
> >
--
----------------------------------------------------------------------
James T. Kaba
Sarnoff Corporation There are 10 kinds of people in the world:
jkaba --at-- sarnoff.com those who understand binary, and those who don't.
609-734-2246