Class BootstrapPnPServer

  extended by
      extended by
All Implemented Interfaces:

public class BootstrapPnPServer
extends UDPServer

The BootstrapPnPServer is used for sending and receiving UDP messages between peers, which is composed of a BootstrapPnPSender and a BootstrapPnPReceiver. The BootstrapPnPSender is responsible for sending MsgType.PING messages to remote peers, while the BootstrapPnPReceiver for receiving MsgType.PONG messages from remote peers.

To start the BootstrapPnPServer, just implement the following codes in the run() method.

 public void run()
        sender = new BootstrapPnPSender();
        scheduler = new Timer("Ping Sender of Bootstrap");
        scheduler.schedule(sender, 10000); // for 10 seconds
        receiver = new BootstrapPnPReceiver(sender.getSocket(), 10);
        Thread receiverThread = new Thread("Pong Receiver of Bootstrap", receiver);

1.0 2006-9-25
Xu Linhao
See Also:
UDPServer, BootstrapPnPSender, BootstrapPnPReceiver

Constructor Summary
BootstrapPnPServer(AbstractMainFrame gui, int port, int maxConn, long period)
          Construct the BootstrapPnPServer with specified paramemters.
Method Summary
 void run()
          Start both sender and receiver for processing UDP messages.
Methods inherited from class
getDatagramSocket, getLocalPort, isAlive, scheduleUDPSender, stop
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public BootstrapPnPServer(AbstractMainFrame gui,
                          int port,
                          int maxConn,
                          long period)
Construct the BootstrapPnPServer with specified paramemters.

gui - the reference of AbstractMainFrame
port - the port to be used for starting the server
maxConn - the maximum number of handlers used for processing UDP messages
period - the sitting up time used for initiating next round of UDP packets dissemination
Throws: - if open socket on the port fails
Method Detail


public void run()
Start both sender and receiver for processing UDP messages.