Example Programs and Configurations
  Home   Sample Code   Software   Lotos Design Docs      



HelloWorld Programs

The HyperCast HelloWorld programs demonstrate various aspects of the HyperCast API.  The programs create an overlay socket that sends and receives messages.  The following are (extended) versions of the HelloWorld programs explained in the chapters  "Basic API" and the "Advanced API"

Compile each file and start the program in multiple windows on the same host or different hosts.

The programs work with any of the "standard" configuration files given below.

From Basic API
with blocking receive operation (2.1) HelloWorld_NoCallBack.java
with non-blocking receive operation (2.1) HelloWorld_CallBack.java
with unicast transmissions  (2.2) HelloWorld_Unicast.java
running as HyperCast Application (2.4): HelloWorldApp.java
From Advanced API
with end-to-end ACK (3.1) HelloWorld_E2EAck.java
with Stream API (3.2) StreamSender.java
with notification handler (3.3): HelloWorld_EventNotification.java
with message interception (3.4): HelloWorld_InterceptCallBack.java
with overlay servers  (3.5) HelloWorld_Overlayserver.java
(Use configuration files with overlay servers)
Security  (3.6) HelloWorld_Security.java
(Use configuration files with Security features enabled)

Configuration Files
-All configuration files can be created from  the HyperCast Configuration Editor program
-Rename the files as needed by the above HelloWorld programs.

Standard Configurations
Default Configuration

Protocol: Delaunay Triangulation (DT)  with buddylist rendezvous 
Control: UDP Unicast
Data: TCP

Required changes:
At least one application must be configured to be a `buddy' that is used by other applications to join the overlay.
  1. On one system, say with IP address,  set
  2. On  all applications (including the above),  set
  • An IP address set to is replaced by an IP address of the local machine. A port number set to 0 is replaced by an unused port. If a port is set to a value >0, but unavailable, another unused port is selected.
  • In (1), the first step sets the address of the node adapter to The node that  allocates this port will become the buddy. (This port must be available.)  In (2), the first  line sets the overlay identifier (The default setting is an empty string. If an overlay socket is started with an empty overlay ID, HyperCast picks an overlay ID consisting of an address and a timestamp), and the second line sets address of the buddy  to that selected in step (1).
Spanning Tree

Protocol:  Spanning Tree (SPT) protocol with broadcast rendezvous 
Control: UDP Multicast
Data: UDP Unicast

Required changes: None


  • The number of recorded hops in the header is set to 1, i.e.,   /Public/RouteRecordSize=1. This is needed to prevent forwarding loops in the (HyperCast) multicast  transmission.
  • The default address for UDP Multicast of the node adapter is If this address is not available, a different value should be picked. 
  • If run in an 802.11 networks in ad-hoc mode, this configuration sets up an application layer ad hoc network.
Configurations with Overlay servers
Overlay Server

Protocol:  Spanning Tree (SPT) protocol with broadcast rendezvous 
Control: UDP Multicast
Data: UDP Unicast

Required changes:
  • The configuration attribute /Public/OverlayServer/HTTP_Server must be changed to the URL of a valid  overlay server, e.g.,
  • An overlay server must be started on some system, e.g., by executing :

   java hypercast.HTTP_Server 8080 

  • To observe the current configuration of the overlay server, run a browser  with the URL of the overlay server.
  • If an overlay server is specified, a configuration object contacts the overlay server before creating the overlay socket.  Depending on the overlay identifier in the configuration file,  the following happens:
    • If the overlay identifier in the configuration file is not stored at the overlay server, the configuration attributes are uploaded to the overlay server, and a new entry is created at the overlay server
    • If the overlay server has an entry for the overlay identifier in the configuration file, the configuration attributes of this entry are downloaded from the server, and merged with the attributes in the configuration file. When merging, the downloaded attributes take precedence over the attributes in the configuration file.
    • If the local configuration file does not specify an overlay identifier, the configuration object uploads its configuration file. The overlay server creates a new overlay identifier, and returns the identifier to the configuration object. The server also creates a new entry with the uploaded attributes. 
Configurations with Securit
Security  (SSL Adapters)

Protocol: DT with buddylist rendezvous
Control: SSL with ciphersuite TLS_RSA_WITH_AES_128_CBC_SHA
Data: SSL with ciphersuite TLS_RSA_WITH_AES_128_CBC_SHA

Required changes:
Very similar to the required changes in the default configuration.
  1. On one system, say with IP address,  set
  2. On  all other applications,  set
  • The attribute
    assumes that there is a keystore file ".keystore" in the working directory containing a public/private key pair
  • The attribute
    assumes that there is an X.509 version 3  file "testcert.cer" in the working directory, that matches the public key in the .keystore file. 
  • The attribute
    specifies the certificate of the CA. Here, it is assumed that testcert.cer is self-signed. 
  • The program using this file must set a private attribute 
    that contains the password to the .keystore file (see HelloWorld_Security.java)
  • The distribution of HyperCast contains files testcert.cer and .keystore that work with the above configuraiton. These files should be replaced by user-defined files.
Security  (Encryption)

Protocol:  Spanning Tree (SPT) protocol with broadcast rendezvous 
Control: UDP Multicast
Data: UDP Unicast
SecurityLevel: Privacy.

Required changes: None

  • This configuration uses the Neighborhood key method (NeighborhoodKey1) for key management. 
  • This configuration uses the following algorithms:
    • Application payload: encrypted with AES (128 bits) and signed with HmacMD5. 
    • Application header: Signed with HmacMD5. 
    • Protocol messages: Signed with HmacMD5. 
  • See instructions for SPT configuration.
  • See instructions for SSL Adapters. 
  • The program using this file must set  these private attributes
    which contain, respectively,  the password to the .keystore file, the alias for the private key in .keystore, and the password for the private key (see HelloWorld_Security.java)


Search this site 
Search WWW

  Contact us

Last Modified: November 2006

Maintained by: hypercast@comm.utoronto.ca

© 2005-6 J. Liebeherr