peer2me.network
Class ConnectionListener

java.lang.Object
  extended bypeer2me.network.ConnectionListener
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionListener
extends java.lang.Object
implements java.lang.Runnable

This class contains a ConnectionListener thread listening for incoming connection attempts from other devices running the same MIDlet built upon the framework. When a incomming connection is detected, a Node representation is created representing the connecting device. A ConnectionListener thread is created in Network.init().

Author:
Torbjørn Vatn & Steinar A. Hestnes

Constructor Summary
ConnectionListener(java.lang.String connectionURL)
          Constructor.
 
Method Summary
 void run()
          This method is called when the ConnectionListener thread is started in the constructor.
 void shutdown()
          This method shuts down this thread and closes the connection to clean up.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionListener

public ConnectionListener(java.lang.String connectionURL)
Constructor. A ConnectionListener is created in the Network.init() method.

Parameters:
connectionURL - The ConnectionURL to listen to
Method Detail

run

public void run()
This method is called when the ConnectionListener thread is started in the constructor. It continously listens for incoming connections matching the serviceID of the peer2me framework. The listener is "passive" and opens a connection waiting for a device to take contact. If an incoming connetion occurs, information is abstracted from the remote node, and a node object containing this connection is created and added to the group on the local node.

Specified by:
run in interface java.lang.Runnable

shutdown

public void shutdown()
This method shuts down this thread and closes the connection to clean up. It is called from FrameworkFrontEnd.shutdownFramework().