SimpleRouter

所属分类:Java编程
开发工具:Java
文件大小:42KB
下载次数:82
上传日期:2009-01-01 21:52:02
上 传 者dengruilong
说明:  使用Java语言编写模拟路由器程序,通过不同的IP端口(port),使用多线程模拟不同的路由器,路由器之间通过UDP协议交换路由信息,根据Bellman-ford算法确定下一条的路由节点。
(The use of Java language router simulation procedures, through different IP port (port), the use of multi-threaded simulation of different routers, through the UDP protocol between routers exchange routing information, according to Bellman-ford algorithm to determine the next a routing node.)

文件列表:
Simple Router\ef.txt (245, 2009-01-01)
Simple Router\log.txt (0, 2009-01-01)
Simple Router\Packet.java (941, 2008-12-29)
Simple Router\Router.java (11305, 2009-01-01)
Simple Router\RouterLocation.java (4880, 2008-12-29)
Simple Router\TopologyFileEntry.java (1108, 2008-12-29)
Simple Router\Topology.java (3164, 2008-12-29)
Simple Router\RouterServer.java (3380, 2009-01-01)
Simple Router\RouterLocationEntry.java (1910, 2008-12-29)
Simple Router\CommandThread.java (2438, 2009-01-01)
Simple Router\RoutingTable.java (12058, 2009-01-01)
Simple Router\RouterThread.java (2380, 2009-01-01)
Simple Router\Command.java (19985, 2008-12-29)
Simple Router\bfnode.java (4370, 2008-12-30)
Simple Router\make.bat (0, 2009-01-01)
Simple Router\bfnode.class (2716, 2009-01-01)
Simple Router\Command.class (10482, 2009-01-01)
Simple Router\RouterLocation.class (3079, 2009-01-01)
Simple Router\CommandThread.class (2056, 2009-01-01)
Simple Router\Router.class (7670, 2009-01-01)
Simple Router\RoutingTable.class (5260, 2009-01-01)
Simple Router\Packet.class (478, 2009-01-01)
Simple Router\RouterLocationEntry.class (1146, 2009-01-01)
Simple Router\RouterServer.class (3422, 2009-01-01)
Simple Router\RouterThread.class (1931, 2009-01-01)
Simple Router\Topology.class (2358, 2009-01-01)
Simple Router\TopologyFileEntry.class (805, 2009-01-01)
Simple Router\rlf.txt (124, 2009-01-01)
Simple Router\tcf.txt (132, 2009-01-01)
Simple Router (0, 2009-01-01)

Simple Routing 1. Compiling the program ------------------------ javac *.java 2. Running the program ---------------------- The program has two components: 1.RouterServer 2.bfnode 3.Command The following files should be present in the directory before running the programs: 1. Topology Configuration File 2. Router Location file 3. Event File Starting RouterServer: $java -classpath . RouterServer Starting bfnode: $java -classpath . bfnode ... The UDP listening port number of the node The UDP listening port number of one of the neighboring nodes The link distance to the Keep listing the pair of and for all your neighboring nodes Indication of the last node information of the network. Upon the input of the command with this argument, the routing message exchanges among the nodes should kick in exit(ctrl-C)Exit the program Starting Command: $java -classpath . Command -f -l -t -o -s The default values are: : ef.txt : rlf.txt : tcf.txt : log.txt It is advisable to use "-s" option for running Command. If it is not used, it might lead to undesirable results because the Command might request the Routers to display the Routing Tables even before the exchange of Distance Vectors is completed. 3. About the Algorthm --------------------- 1. The Distance Vector Algorithm given in the *2nd edition* of the text book is implemented. So the format of the Routing Tables is according to the Figure 4.7 in the 2nd edition of the text book where: * There is a row corresponding to each destination in the network * There is a column corresponding to each neighbor of the given node. * An entry (i,j) gives the distance to the destination 'i' when the first hop on the path is neighbor 'j' 2. For convenience, infinity is taken as 10000. The client has an easy-to-use Graphical User Interface (GUI) to the user. 3. The operations performed by the Router for various commands are: *addRouter: returns true if its id matches (trivial) *deleteRouter: if the node is a neighbor, removes the corresponding row and column and updates the distance vector. if it is not a neighbor, ignores the command *update: if the node is not present in the routing table, adds a new row and column corresponding to the node. if the node is present and is a neighbor, it will modify the column corresponding to the node. if the node is present and is not a neighbor, it will add a column. *packets: return the packets and make packets 0 *display: display the routing table *route: send the next hop *step: send the dv to its incoming neighbors 4. Assumptions/Limitations -------------- 1. The algorithm does not implement Poisson Reverse. This might lead to a count-to-infinity problem. 2. After finishing the program, the Routers have to be killed by hand. 5. File Directory ----------------- bfnode.java - program to get input information RouterServer.java - work as a router server Router.java - the code for Router RouterThread.java - A thread that listens for packets from other routers CommandThread.java - a thread that listens for commands from Command program TopologyFileEntry.java - an entry in the topology file Topology.java - the initial toplogy RouterLocationEntry.java - an entry in the Router Location File RouterLocation.java - the router locations RoutingTable.java - the routing table Command.java - the command program Packet.java - the distance vector packet

近期下载者

相关文件


收藏者