The DoDWAN platform
DoDWAN Apps for netbooks
DoDWAN Apps for smartphones
Configuring the Wi-Fi interface for ad hoc networking
Before starting any DoDWAN-based application on a mobile host, one must configure this host’s Wi-Fi interface so it can operate in ad hoc mode. The scripts set_dodwan_network.sh (for Linux systems) and set_dodwan_network.ps1 (for Windows 7 systems) are meant to help you achieve this task. If you cannot configure your Wi-Fi interface using these script files, please refer to Network_configuration for further instructions regarding network configuration.
On a Linux platform
The shell script set-dodwan-network.sh must be used on a Linux platform. Note that this script must be executed with root privileges, as it must configure the Wi-Fi interface for ad hoc networking:
% sudo sh set_dodwan_network.sh Detected Wi-Fi interface: wlan0 Interface wlan0 is now configured for ad hoc networking (ssid=DODWAN-ADHOC, channel=1)
On a Windows 7 platform
On a Windows 7 platform execute the following command in a Powershell launched with Administrator privileges. Note that you may additionally have to deactivate your firewall to allow DoDWAN traffic (UDP, default port 8500).
> set-dodwan-network.ps1 Detected Wi-Fi interface: Wireless network connection Profile DODWAN is added on interface Wireless network connection. Profile "DODWAN" of interface "Wireless network connection" is updated. Connection request is received successfully. Ok.
Running the sample programs
The Java source programs samplePublisher.java and sampleSubscriber.java illustrate the roles of publisher and subscriber in a publish/subscribe distributed application.
Assuming the DoDWAN package was installed in the home directory, and the file samplePublisher.java is in the current directory, the publisher code can be compiled and run the following way (substitute $HOME with %USERPROFILE% on Windows):
% javac -cp $HOME/DoDWAN/home/lib/dodwan-2.1.0.jar samplePublisher.java % java -cp ".:$HOME/DoDWAN/home/lib/dodwan-2.1.0.jar" samplePublisher
Note: while typing the above commands you may have to adjust the version number of DoDWAN based on the actual version of the distribution file you have downloaded.
The subscriber code can be compiled and run similarly:
% javac -cp $HOME/DoDWAN/home/lib/dodwan-2.1.0.jar sampleSubscriber.java % java -cp ".:$HOME/DoDWAN/home/lib/dodwan-2.1.0.jar" sampleSubscriber
First run the subscriber and the publisher on two distinct properly configured devices (see Network_configuration for instructions on how to prepare hosts to run DoDWAN).
On the subscriber side, the program subscribes to messages in “French” or “English” and that pertain to a topic that contains “DTN”. This subscription is bound to a ’processor’ that handles received messages by simply displaying in XML the descriptor of the message before the content itself. Leave this program running until no reception is wished. Then quit by interrupting the Java program (CTRL-C).
On the publisher side, the user is repeatdly asked for the characteristics (language, topic and content) of a message that is published in the network. Again, you can quit by interrupting the Java program (CTRL-C).
As far as the characteristics typed in on the publisher side are compatible with the subscription pattern hard-coded in the sucriber program, the subscriber will effectively receive and display the published messages. Note that the reception is not immediate: a DoDWAN instance performs exchanges with neighbouring devices periodically, with a default period of 15 seconds.
You can run other instances of the subscriber and the publisher on other hosts in the network. You should thus observe that:
A device can play the role of a publisher and the role of a subscriber. In this case, you should merge the two corresponding Java sources into one.