Re: Multiple broadcasts

From: Alan J. McFarlane (alanjmcf_at_yahoo.com.INVALID)
Date: 02/19/04


Date: Thu, 19 Feb 2004 00:27:53 -0000

Arkady Frenkel <arkadyf@hotmailxdotxcom> wrote:
> "Christoffer Bergman" <christoffer.bergman@audiodev.com> wrote in
> message news:82C75297-08D9-4573-8B50- F535E504111F@microsoft.com...
>> I want to make a broadcast on my subnet, and I have written it like
>> this:
[...]
>> The question is, will this be broadcasted on all my network cards,
>> or just one of them? I read an article that said that there are no
>> standard here. According to
>> that article, BSD had implemented broadcast so that it was
>> only boadcasted on the first available network card.
>> How does it work for Windows?

I'm pretty sure that's a broadcast is only sent on one interface in Windows.
I don't know where exactly the stack came from (or how), but it behaves a
lot like the BSD one.

>> If it is only broadcasted on the first network card, how do I make it
>> broadcast on ALL available cards in the computer?
>>

When using broadcast, bind a socket to each local IP Address (maybe also
checking whether any of the addresses are on the same interface) and send
each packet out of each.

> I think ( never try that ) that broadcast will be send from adapter
> which have lowest metric ( or first if equal ) in route table.
> If my proposition correct , you can change ( increase ) after send
> that metric on adapter you just send and try next time , it have to
> be sent from next one. Try and tell us the results.
>
And change the routing of all other traffic (unicast etc) too? Yikes!

See my discoveries on how the interface to send a multicast packet on is
chosen, at
http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=0BDia.1372%240i4.7501%40newsfep4-glfd.server.ntli.net ,
broadcast might behave something the same... However there's apparently
only ever one 255.255.255.255 route in the table though ("route print"). I
wonder whether this is all covered in Microsoft's tcpip2000.doc.

By the way, there are only a few good reason today to use broadcast rather
than multicast. One possiblity is if you are communicating with some
embedded device with a very slim TCP/IP stack that doesn't implement
multicast receive (but does do broadcast). As well as all the good reasons
to use multicast for its effect on the network etc (network load, CPU load,
for future upgrade to IPv6, ability to scale off the local segments in the
future if required) the programming of each is similar in scale. Though
you've already written the broadcast code. :-)

* Broadcast:
** sender:
setsockopt(SO_BROADCAST)
sendto(255.255.255.255)
** receiver:
setsockopt(SO_BROADCAST) -- If KB197511/KB154460 are to be believed.
recvfrom()

* Multicast
** sender:
sendto(239.255.yy.zz etc)
** receiver:
setsockopt(IP_ADD_MEMBERSHIP <same group address>)
recfrom() etc

-- 
Alan J. McFarlane
http://homepage.ntlworld.com/alanjmcf/
Please follow-up in the newsgroup for the benefit of all.


Relevant Pages

  • Wireless LAN unter Gentoo Linux auf Acer Aspire 3022
    ... UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ... eth1 Link encap:UNSPEC HWaddr ... Date format: Timestamp ...
    (de.comp.os.unix.linux.hardware)
  • Re: UDP broadcast with 2 adapters
    ... Multicast does not solve Denville's problem in any ... If you want to broadcast on a specific interface only, ... I use UDP broadcasts on a small network to synchronise applications and share info - all without problems, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Multicast MAC and Unicast IP Address
    ... I am interested in knowing what the rules are because up to now everybody just told me that it is a strange way to use multicast but some also said that it is illegal. ... When a host sends a datagram to a link-layer broadcast address, the IP destination address MUST be a legal IP broadcast or IP multicast address. ... I believe that the use of a multicast MAC address to send a unicast IP packet to a group of devices (e.g., a cluster) is a perfectly correct use of link-layer multicast, assuming that the cluster software knows how to deal with the fact that multiple devices are receiving the same IP datagram. ...
    (comp.dcom.lans.ethernet)
  • Re: [Full-Disclosure] Windows SP2 firewall: Famous for 3 seconds?
    ... > | Multicast and broadcast network traffic differ from unicast traffic ... > | number of scenarios from working, ... This has much bigger significance for IPv6 where ARP messages have been ...
    (Full-Disclosure)
  • Re: When does Linux drop UDP packets?
    ... On Fri, 5 Jun 2009, Alexander Clouter wrote: ... It's dead easy to transmit and receive multicast traffic, ... By using broadcast traffic the load (okay, ... discovering that multicast can be used for device discovery rather than ...
    (Linux-Kernel)