|
Pervasive Discovery Protocol - Reference Implementation
|
|
|
|
|
|
Contact:
|
Universidad Carlos III de Madrid
Escuela Politécnica Superior
Edificio Torres Quevedo
Avda de la Universidad, 30
28911 Leganés (Madrid) SPAIN
|
|
|
|
|
|
|
Launch PDP Demo Client by simply invoking your preferred JVM as follows:
java -cp pdp.jar;PDPClient.jar PDPClient
In order to test it on a Pocket PC you must take into account that a Personal Profile compliant JVM must be available on the device (we have tested the implementation on the IBM J9 JVM, available on the IBM WSDD site). To configure and install the IBM J9 on a Pocket PC please download the IBM Websphere Studio Device Developer from the IBM site and follow their instructions as far as any new IBM J9 version may vary its installation steps.
Note: you may experience some problems when displaying the PDP Demo Client on Linux because of the different font sizes between Linux and Windows in Java.
|
|
|
|
|
In order to run PDP on a Pocket PC you must have a Personal Profile compliant JVM on the device. We
have tested our implementation on the IBM J9 included on the IBM WSDD v5.5, freely downloadable from
the IBM site.
To install the VM on your Pocket PC you must create a [J9_dir] directory on
your device and then copy the following files (availables on the
[WSDD_DIR]\ive\runtimes\pocketpc\arm\ive\bin\ directory from your computer)
to the [J9_dir]\bin directory on your Pocket PC:
- iverel20.dll
- j9.exe
- j9dyn20.dll
- j9foun20.dll
- j9hook20.dll
- j9prt20.dll
- j9thr20.dll
- j9vm20.dll
- j9w.exe
- j9zlib20.dll
To run PDP you must have access to the Java Foundation profile. In order to archieve this you must copy
the following file (from [WSDD_DIR]\ive\runtimes\common\ive\lib\jclFoundation\ ) to the
[J9_dir]\lib\jclFoundation\ directory on your device:
To run PDP Client (AWT based) you must have access to the Java Personal Profile. In order to archieve
this you must copy the following file (form [WSDD_DIR]\ive\runtimes\pocketpc\common\ive\lib\jclPPro\ )
to [J9_dir]\lib\PPro\ on your device:
Any new implementation of either the IBM J9 or the IBM WSDD may vary on its installation steps. Please refer
to their instructions in order to properly install the VM on your device.
NOTICE: We have found a bug on the IBM J9 implementation for the java.net.InetAddress class. PDP
continuosly checks network connectivity to supply network faliures, and this bug makes the class NetworkSniffer
not to work properly. To solve this bug you must modify the method lookupHostByName ( String host )
on the class java.net.InetAddress available on the [WSDD_DIR]\ive\runtimes\common\ive\lib\jclFoundation\source\classes.zip
file.
Just change the line:
int ttl = -1;
at the very beginning of the method, for the line
int ttl = 0;
Then compile the class and pack the new .class file on the .zip file, and transfer it to your Pocket PC.
|
|
|
|
|
You can freely develope your own PDP client to use it for your own applications if you include a reference to us in your work. Developing a new PDP client is a very simple task, just follow these steps:
- Create a reference to a new PDP object
PDP mypdp = new PDP ( local_cache_size, remote_cache_size, availability_time_in_seconds );
- Set up your PDP object. By default PDP wont search/avertise services
mypdp.setUA ( true ); // Sets User Agent on
mypdp.setSA ( true ); // Sets Service Agent on
mypdp.setDereg ( true ); // Sets PDP to inform when leaving the network
- Add your service(s) information on PDP's local cache
boolean done = mypdp.addLocal ( service_type_string, url_string, expiration_time );
where the boolean will inform you if your service has been added.
- Search a service with
Object lock = mypdp.searchService ( type_to_search, any );
where lock is the monitor where PDP will notify when your reply is done
- Get a reply for your request
Vector reply = mypdp.getResponse ( );
where "reply" is a "ServiceEntry" vector with your reply.
- Leave the network with
mypdp.byebye ( );
See the API documentation or the PDP Demo Client source code for further information.
|
|
|
|
|
|
|