views:

592

answers:

3

Hi,

I'm attempting to send multichannel audio over WiFi from one server to multiple client computers using UDP broadcast on a private network.

I'm using software called Pure Data, with a UDP broadcast tool called netsend~ and netreceive~. The code is here: http://www.remu.fr/sound-delta/netsend~/

To cut a long story short, I'm able to achieve sending 9 channels to one client computer in a point-to-point network, but when I try to do broadcast to 2 clients (haven't yet tried more), I get no sound. I can compress the audio and send 4 channels compressed (about 10% size of uncompressed) over UDP broadcast to 2 clients successfully. Or I can send 1 channel over UDP broadcast to 2 clients, with some glitches.

The WiFi router is a Linksys WRT300N. All computers are running Windows XP. The IP addresses are 192.168.1.x, with subnet mask 255.255.255.0 and the subnet broadcast address: 192.168.1.255.

I'm curious - what happens to UDP broadcast packets in the router? If I have a subnet mask of 255.255.255.0, then does the router make 254 packets for every packet sent ot the broadcast address?

My WiFi bandwidth is at least 100Mbps, but I can't seem to send audio of more than around 10Mbps over UDP broadcast to multiple clients.

What's stopping me from sending audio up to the bandwidth limit of the WiFi?

any suggestions for socket code modifications, network setups, router setups, subnet modifications... all very much appreciated!

thanks Nick

A: 

I'm curious - what happens to UDP broadcast packets in the router? If I have a subnet mask of 255.255.255.0, then does the router make 254 packets for every packet sent ot the broadcast address?

No the "router" doesn't make 254 individual packets. Furthermore, I suspect the protocol leverages "multicast" addresses rather than using a "broadcast" address.

Since broadcast/multicast traffic can easily be misused, there are many networking equipment that limit/block by default such traffic. Of course, some essential protocols (e.g. ARP, DHCP) rely on broadcast/multicast addresses to function and won't be blocked by default.

Hence, it might be a good thing to check for multicast/broadcast control knobs on your router.

jldupont
I've looked through everything in the router, and didn't find much that could help. The WRT300N interface is actually viewable here: http://ui.linksys.com/files/WRT300N/0.93.9/ I was wondering if it might help to reduce my subnet mask to 255.255.255.240 or something like that - would that reduce traffic?
Nick
If the software is actually using a Multicast address to send traffic to multiple Clients, changing the subnet mask will have no effect: Multicasting doesn't rely on this configuration parameter.
jldupont
The first to do IMO is to determine if the software is actually using Multicasting before proceeding to another step.
jldupont
A: 

New information: the system is definitely using broadcast, not multicast.

Also, I can successfully stream 4 channels of uncompressed audio (2.8Mbps) on a wired (cat5) connection over the same UDP broadcast setup.
When I switch to 802.11N (connection speed reaching between 200Mbps - 300Mbps), I cannot get an unbroken stream of 4 channels on UDP broadcast to 2 receivers. But if I then do point-to-point streaming (to an individual IP on the same receiver machines), still on the same WiFi connection, I can get a clean 4 channel stream (2.8Mbps).

So, it seems like somehow there is extra bandwidth overhead for UDP broadcast in comparison to a UDP direct connection. This extra overhead makes WiFi unreliable as a transport, although a wired connection will still work.

Why is broadcast on WiFi so poor, and what can I do to improve it?

Nick
You should take this information and combine it with your original question. That's the way SO works. Otherwise, this info is lost on anyone coming along and only reading your original question. So please combine them and maybe even reword it (ie, don't just tack this onto the end).
shank
+1  A: 

Are all parties connected via WiFi or is the sender using a wired connection to the Access Point? Broadcast data will be transmitted as unicast data from a station to an access point and the access point will then retransmit the data as broadcast/multicast traffic so it will use twice the on-air bandwidth compared to when the sender sits on the wired side of the AP.

When sending a unicast frame the AP will wait for an ACK from the receiving station and it will retransmit the frame until the ACK arrives (or it times out). Broadcast/multicast frames are not ACKed and therefore not retransmitted. If you have a busy/noisy radio environment this will cause the likelyhood of dropped packets to increase, potentially a lot, for multicast traffic compared to unicast traffic. In an audio application this could certainly be audible.

Also, IIRC, broadcast/multicast traffic does not use the RTS/CTS procedure for reserving the media which exarbates the dropped packets problem.

It could actually be the case that multiple unicast streams work better than a single multicast stream under less-than-ideal radio conditions given that the aggregated bandwidth is high enough.

If you can I would suggest that you use wireshark to sniff the WiFi traffic and take a look at the destination address in the 802.11 header. Then you can verify if the packets are actually broadcast or not over the air.

Per Ekman