|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectManager
Emulator
Manages an emulated node
| Field Summary |
| Fields inherited from class Manager |
parser, reader, sortedEvents |
| Constructor Summary | |
Emulator(java.lang.String trawlerName,
int trawlerPort,
int localUDPPort)
Create a new emulator |
|
| Method Summary | |
long |
now()
Retrieve current time in milliseconds |
boolean |
sendNodeMsg(int nodeAddr,
java.lang.String msg)
Sends the msg to the the specified node |
boolean |
sendPkt(int from,
int to,
byte[] pkt)
Send the pkt to the specified node |
void |
start()
Starts the emulated node do: Read commands from the fishnet file if there is one Process any defered events Process 1 pending incoming message. |
| Methods inherited from class Manager |
addEvent, addTimer, addTimerAt, readFishFile, setFishnetFile, setParser, setTimescale, stop |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Emulator(java.lang.String trawlerName,
int trawlerPort,
int localUDPPort)
throws java.net.UnknownHostException,
java.net.SocketException,
java.io.IOException,
java.lang.IllegalArgumentException
trawlerName - Name of the machine that the Trawler is ontrawlerPort - The port that the Trawler is listening onlocalUDPPort - The UDP port that this node should use to talk to its neighbors
java.net.UnknownHostException - If the trawlerName cannot be resolved
java.net.SocketException - If there is an error in creating a TCP socket
java.io.IOException - If there is an error in writing to the TCP socket
java.lang.IllegalArgumentException - If the local port given is already in use| Method Detail |
public void start()
Starts the emulated node do: Read commands from the fishnet file if there is one Process any defered events Process 1 pending incoming message. Timeout when next event is supposed to occur loop
start in class Manager
public boolean sendPkt(int from,
int to,
byte[] pkt)
throws java.lang.IllegalArgumentException
sendPkt in class Managerfrom - The node that is sending the packetto - Int spefying the destination nodepkt - The packet to be sent, serialized to a byte array
java.lang.IllegalArgumentException - If the arguments are invalid
public boolean sendNodeMsg(int nodeAddr,
java.lang.String msg)
sendNodeMsg in class ManagernodeAddr - Address of the node to whom the message should be sentmsg - The msg to send to the node
public long now()
now in class Manager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||