Previous Topic

Next Topic

Book Contents

Book Index

UPnP Issues

Common issues that can hinder the UPnP component proper usage are described below.

Cannot Join to Multicast Group

If your start the UPnP Driver bundle on Linux or Solaris or any Unix-like OS, multicasting must be preliminary enabled.

In older Linux distributions, it is possible that multicasting support is not set correctly on network interfaces by their drivers. To check if a network interface has multicast enabled, use the "ifconfig" command:

test:~# ifconfig eth0

The response should be something like this

eth0 Link encap:Ethernet HWaddr 00:01:02:15:33:84
inet addr:192.168.240.77 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::201:2ff:fe15:3384/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

The MULTICAST flag is set on the interface above. If it is missing, try setting it manually, for example:

ifconfig eth0 multicast

You may still receive one of the following exceptions when you attempt to start the UPnP Driver:

                     ...
Caused by: java.io.IOException
        at java/net/PlainDatagramSocketImpl.<413>(bytecode:25)
        at java/net/PlainDatagramSocketImpl.<331>(bytecode:4)
        at java/net/MulticastSocket.joinGroup(Ljava/net/InetAddress;)V(bytecode:44)
                     ...

                     ...
Caused by: java.net.SocketException: No such device
        at org.apache.harmony.luni.platform.OSNetworkSystem.setSocketOption(Native Method)
        at org.apache.harmony.luni.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:302)
        at org.apache.harmony.luni.net.PlainDatagramSocketImpl.join(PlainDatagramSocketImpl.java:202)
        at java.net.MulticastSocket.joinGroup(MulticastSocket.java:205)
                     ...

Usually, the reason is missing route for the multicast packets. You can use the Linux route command to see the details of the kernel routing table. An example of such problematic routing table is:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.64.64.65     *               255.255.255.255 UH    0      0        0 ppp1
172.26.38.1     *               255.255.255.255 UH    0      0        0 ppp1
172.26.38.2     *               255.255.255.255 UH    0      0        0 ppp1
192.168.29.0    *               255.255.255.0   U     0      0        0 eth0

The UPnP Driver is using the "239.255.255.250" multicast address. It can be routed in one of the following ways:

No Valid IPv4 Addresses

On an attempt to start UPnP Driver bundle, you may receive the following exception:

                     ...
Caused by: java.lang.Exception: Cannot find any IP addresses on the host system in IPv4 mode!
                     ...

In case you are using DHCP, the IP addresses can be assigned asynchronously by the DHCP server. The UPnP Driver needs the IP address assigned to the device on which it will be started. This issue can be solved in different ways depending on the specific requirements. We recommend using the features provided by the Network Configurator bundle to manage the lifecycle of the UPnP Driver bundle depending on the specific network events. You can also provide an external script to track the changes in the network state and execute the needed actions to the UPnP Driver.

Cannot Activate the UPnP Component in IPv6 Mode on Windows XP

On an attempt to start the UPnP Driver bundle in IPv6 mode on Windows XP, you may receive the following exception:

                    ...
Caused by: java.net.SocketException: The address is not available
        at java.net.Socket.setSocketOptionImpl(Native Method)
        at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:612)
        at java.net.PlainDatagramSocketImpl.joinGroup(PlainDatagramSocketImpl.java:243)
        at java.net.MulticastSocket.joinGroup(MulticastSocket.java:218)
                    ...

Supposedly, this can be caused by the Teredo Tunneling Pseudo-Interface tunneling interface. To solve the problem, you can remove it by using the following command line:

netsh interface ipv6 delete interface "Teredo Tunneling Pseudo-Interface"

In addition, you need to disable the IPv6 Helper Service.

No UPnP Devices Are Discovered

When the UPnP Driver bundle is activated you may notice that there are no available UPnP-enabled devices. Furthermore, there are no ERROR messages logged.

You should check whether the system on which the UPnP component is installed is using a firewall and make sure it is not configured to block UPnP packets. In case it is blocking UPnP packets, configure it to accept the following rules required by the UPnP Driver bundle to function properly:

The iptables should contain the following two ports:

target     prot opt source               destination
ACCEPT     udp  –-  anywhere             anywhere            udp dpt:1900
ACCEPT     tcp  –-  anywhere             anywhere            tcp dpt:40044

For testing purposes, you may opt to delete all iptables rules and see if this would help detecting UPnP devices. The console command is as follows:

iptables --flush

This command is for testing purposes only! It disables any firewalls you might be using!