multicast over wifi interface

Phil Meyer pmeyer at themeyerfarm.com
Mon Feb 6 19:02:33 UTC 2006


Is it possible to send multicasts over a wifi interface?

With madwifi (atheros) and with airo (cisco) it seemd to
just ignore muticasts.

Using ethereal, no multicast packets appear on the wlan0 or eth1
interfaces.  All other types of traffice seem normal enough.

Here is a snippet of code that send a multicast to every interface.
The multicasts appear on the wired interface, but not on the wifi.

This is the code fragment being used, it's simply repeated once per
second.

        try {
            InetAddress localHost = InetAddress.getLocalHost();
            String message = localHost.getHostName() + "|" +
InetAddress.getByName(localHost.getHostName()).getHostAddress() + "|" +
this.socketPort;
            
            InetAddress group = InetAddress.getByName("230.0.0.1");
            DatagramPacket packet;
            packet = new DatagramPacket(message.getBytes(),
message.getBytes().length, group, 4447);
            
            Enumeration<NetworkInterface> allNets =
NetworkInterface.getNetworkInterfaces();
            while (allNets.hasMoreElements())  {
                NetworkInterface aNet = allNets.nextElement();
                if (aNet.getInetAddresses().hasMoreElements()) {
                    MulticastSocket s2 = new MulticastSocket();
                    try {
                    s2.setNetworkInterface(aNet);
                    s2.joinGroup(group);
                    s2.setTimeToLive(this.discoveryTTL);
                    System.out.println("Sending out: " +
aNet.getDisplayName());
                    s2.send(packet);
                    } catch (SocketException seErr) {
                        seErr.printStackTrace(System.err);
                    }
                    s2.close();
                }
            }
        } catch (IOException ioErr) {
            ioErr.printStackTrace(System.err);
        }




More information about the fedora-list mailing list