Hi All,

        I am using Openslp (version 1.2.1) and the Java Client (version
1.0.0). 
I have downloaded these versions from site www.openslp.org.

I can register my service with SA using command
        slptool register service:service_test:http://192.168.10.158:5988

The service gets properly registered. I can discover the service using
command
        slptool findsrvs service:service_test

This gives the result as 

service:service_test:http://192.168.10.158:5988,65535


Now, here the problem I am facing is that, when I am trying to discover the
same services using Openslp Java Client, the time of getting responses is
much greater than using slptool command. 

Time of getting responses using

Slptool                  2 sec
Java client     20 sec

I have checked for the APIs called from slptool & the Java client, they both
use the same APIs like findsrvs for finding services.

So, can anybody tell me how can I reduce the time duration of the service
responses using the same Java client? or should I change my way of
registering the service with SA? in order to get faster responses. 

Or are there any settings related to slp?

The code from Java client is pasted below.


-Thanks,
Harshal.


Java client :- 

package com.cristie.slp;

import java.util.Properties;
import java.util.Vector;

import com.solers.slp.Locator;
import com.solers.slp.ServiceLocationEnumeration;
import com.solers.slp.ServiceLocationManager;
import com.solers.slp.ServiceType;
import com.solers.slp.ServiceURL;

public class ListDetail {

    void list() throws Exception {
        org.apache.log4j.BasicConfigurator.configure();
        org.apache.log4j.Category.getRoot().setPriority(
                org.apache.log4j.Priority.WARN);
        // The following are necessary for secure use
        Properties p = new Properties();
        p.put("net.slp.traceDATraffic", "false");
        p.put("net.slp.traceMsg", "false");
        p.put("net.slp.traceDrop", "true");
        p.put("net.slp.traceReg", "false");

        ServiceLocationManager.init(p);
        Locator locate = ServiceLocationManager.getLocator(java.util.Locale
                .getDefault());
        Vector scopes = new Vector();
        scopes.add("default");
        /*
         * Finds all service types that have a registered URL. Parameters:
         * namingAuthority - the naming authority to search in, or empty
string
         * if all. Returns: ServiceLocationEnumeration of ServiceType
objects.
         */

        ServiceLocationEnumeration all_ser = locate.findServiceTypes("*",
                scopes);
        while (all_ser.hasMoreElements()) {
            ServiceType type = (ServiceType) all_ser.next();
            String type1 = String.valueOf(type);
            System.out.println(type1);
            if (type1.toString().startsWith("service:service")) {
                ServiceLocationEnumeration type_enum = locate.findServices(
                        type, scopes, "");

                while (type_enum.hasMoreElements()) {
                    ServiceURL url = (com.solers.slp.ServiceURL) type_enum
                            .next();
                    String service = url.toString();
                    System.out.println("\t" + service);
                }// end of while
                type_enum.destroy();
            }// end of if
        }// end of while
        all_ser.destroy();
    }// end of list

    public static void main(String[] args) throws Exception {
        ListDetail l = new ListDetail();
        l.list();
    }
}



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Openslp-users mailing list
Openslp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-users

Reply via email to