Skip to content

SLP Java function causing SocketException due to IP_MULTICAST_IF

I’m attempting to use Java to find a SLP service named test, that is running on my network and create a connection to it. I know the service is running and can use the command “slptool findsrvs service:test” to find it. This command returns “service:test://,65535”. However the following code:

import java.util.Locale;
import ch.ethz.iks.slp.*;

public class OpenConnection {

    public static void main(String[] args) throws ServiceLocationException {
        Locator locator = ServiceLocationManager.getLocator(new Locale("en"));

        ServiceLocationEnumeration sle = locator.findServices(new ServiceType("service:test"), null, null);

        System.out.println("Looking up ...");
        while (sle.hasMoreElements()) {
            ServiceURL foundService = (ServiceURL) sle.nextElement();

produces the following output: bad argument for IP_MULTICAST_IF: address not bound to any interface
at Method)
at ch.ethz.iks.slp.impl.SLPCore.<clinit>(
at OpenConnection.main(

Looking up ...

I’m assuming the null is printed for the print sle.nextElement() statement due to the failure of the locator look up in line 7:

Locator locator = ServiceLocationManager.getLocator(new Locale("en"));

So my question is does anyone know why a bad argument for IP_MULTICAST_IF could cause this and how to fix it? And if someone sees something that could be causing a problem other than the IP_MULTICAST_IF please feel free to point it out.

On a side note if it helps to know I am using JavaSE-1.6, jslp-0.7.1, and commons-loggin-1.1.1 libraries on Ubuntu 11.04.


I just ran into the same issue. What fixed it for me was doing a

System.setProperty("", "true")

at startup, which can also be done by adding the following argument to the java cmd line instead.