javaslp

How do I change the port used for livetribe SLP?


I'm attempting to use LiveTribe SLP module (http://livetribe.codehaus.org/LiveTribe-SLP) to provide an SLP service for an application. I want to change the port from 427 to something else entirely. The documentation is sparse and even more confusing is that in the FAQ, it claims to link to an example that would show me exactly what I'm looking for. Unfortunately, it doesn't (unless I'm overlooking something). Does anyone know how to do this?


Solution

  • There is a client and server example here: http://livetribe.org/SLP-Examples-JMX
    (Link broken.)

    These are the important lines on the server side:

    // Allow this code to be run by non-root users on Linux/Unix
    Settings settings = new MapSettings();
    settings.put(Keys.PORT_KEY, 4427);
    
    // Create the SLP ServiceAgent that advertises the JMX service
    ServiceAgent serviceAgent = SLP.newServiceAgent(settings);
    

    And on the client side:

     // Allow this code to be run by non-root users on Linux/Unix
    Settings settings = new MapSettings();
    settings.put(Keys.PORT_KEY, 4427);
    
    // Create the SLP UserAgentClient that discovers services
    UserAgentClient userAgentClient = SLP.newUserAgentClient(settings);