sg.edu.nus.peer.request
Class BootstrapPnPSender

java.lang.Object
  extended by java.util.TimerTask
      extended by sg.edu.nus.peer.request.UDPSender
          extended by sg.edu.nus.peer.request.BootstrapPnPSender
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, PnPListener, UDPListener

public class BootstrapPnPSender
extends UDPSender
implements PnPListener

The BootstrapPnPSender is responsible for sending UDP packets with the type of MsgType.PING out to remote nodes.

The method sendPacket() must be implemented to send UDP packages to remote peers. To obtain the IP address list of the remote peers to be contacted, just invoke the interface of PeerMaintainer.getServers().

Version:
1.0 2006-10-9
Author:
Xu Linhao
See Also:
BootstrapPnPServer, UDPSender

Constructor Summary
BootstrapPnPSender(AbstractMainFrame gui, int port)
          Construct the UDP sender with specified parameters.
 
Method Summary
 void nodeAlive(PeerInfo info)
          This method will be invoked if a node is still alive.
 void nodeFailure(PeerInfo info)
          This method will be invoked when a node is detected as failure.
 
Methods inherited from class sg.edu.nus.peer.request.UDPSender
getDatagramSocket, getLocalPort, isAlive, run
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BootstrapPnPSender

public BootstrapPnPSender(AbstractMainFrame gui,
                          int port)
                   throws java.net.SocketException
Construct the UDP sender with specified parameters.

Parameters:
gui - the reference of the AbstractMainFrame
port - the port to be used for initializing DatagramSocket
Throws:
java.net.SocketException - if cannot initialize DatagramSocket on the specified port
Method Detail

nodeAlive

public void nodeAlive(PeerInfo info)
Description copied from interface: PnPListener
This method will be invoked if a node is still alive.

Specified by:
nodeAlive in interface PnPListener
Parameters:
info - the PeerInfo instance

nodeFailure

public void nodeFailure(PeerInfo info)
Description copied from interface: PnPListener
This method will be invoked when a node is detected as failure.

Specified by:
nodeFailure in interface PnPListener
Parameters:
info - the PeerInfo instance