public class PingApplication extends Application
PingAppReporter class can be used to record
information about the application behavior.PingAppReporter| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
APP_ID
Application ID
|
static java.lang.String |
PING_DEST_RANGE
Destination address range - inclusive lower, exclusive upper
|
static java.lang.String |
PING_INTERVAL
Ping generation interval
|
static java.lang.String |
PING_OFFSET
Ping interval offset - avoids synchronization of ping sending
|
static java.lang.String |
PING_PASSIVE
Run in passive mode - don't generate pings but respond
|
static java.lang.String |
PING_PING_SIZE
Size of the ping message
|
static java.lang.String |
PING_PONG_SIZE
Size of the pong message
|
static java.lang.String |
PING_SEED
Seed for the app's random number generator
|
appID| Constructor and Description |
|---|
PingApplication(PingApplication a)
Copy-constructor
|
PingApplication(Settings s)
Creates a new ping application with the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getDestMax() |
int |
getDestMin() |
double |
getInterval() |
double |
getLastPing() |
int |
getPingSize() |
int |
getPongSize() |
int |
getSeed() |
Message |
handle(Message msg,
DTNHost host)
Handles an incoming message.
|
boolean |
isPassive() |
Application |
replicate() |
void |
setDestMax(int destMax) |
void |
setDestMin(int destMin) |
void |
setInterval(double interval) |
void |
setLastPing(double lastPing) |
void |
setPassive(boolean passive) |
void |
setPingSize(int pingSize) |
void |
setPongSize(int pongSize) |
void |
setSeed(int seed) |
void |
update(DTNHost host)
Sends a ping packet if this is an active application instance.
|
getAppID, getAppListeners, sendEventToListeners, setAppID, setAppListenerspublic static final java.lang.String PING_PASSIVE
public static final java.lang.String PING_INTERVAL
public static final java.lang.String PING_OFFSET
public static final java.lang.String PING_DEST_RANGE
public static final java.lang.String PING_SEED
public static final java.lang.String PING_PING_SIZE
public static final java.lang.String PING_PONG_SIZE
public static final java.lang.String APP_ID
public PingApplication(Settings s)
s - Settings to use for initializing the application.public PingApplication(PingApplication a)
a - public Message handle(Message msg, DTNHost host)
handle in class Applicationmsg - message received by the routerhost - host to which the application instance is attachednull
if the application wants the router to stop forwarding the
message.public Application replicate()
replicate in class Applicationpublic void update(DTNHost host)
update in class Applicationhost - to which the application instance is attachedpublic double getLastPing()
public void setLastPing(double lastPing)
lastPing - the lastPing to setpublic double getInterval()
public void setInterval(double interval)
interval - the interval to setpublic boolean isPassive()
public void setPassive(boolean passive)
passive - the passive to setpublic int getDestMin()
public void setDestMin(int destMin)
destMin - the destMin to setpublic int getDestMax()
public void setDestMax(int destMax)
destMax - the destMax to setpublic int getSeed()
public void setSeed(int seed)
seed - the seed to setpublic int getPongSize()
public void setPongSize(int pongSize)
pongSize - the pongSize to setpublic int getPingSize()
public void setPingSize(int pingSize)
pingSize - the pingSize to set