CS433/533 Programming Assignment 2 OverviewFishnet n Network protocol simulator & emulator n Read fishnet-intro.pdf n Get started n Network topology (.topo) for emulator n Simulation script (.fish) for simulator n trawler.pl: emulation coordinator n fishnet.pl: interactive node emulationWhere to put your code n Under directory proj/ n Related files: Node.java, TCPManager.java, TCPSock.java n Do NOT modify files under lib/ n E.g., the file ‘Transport.java’ only serves as definition of transport packet format, do not rewrite itNode.java n send(int destAddr, Packet packet)! n Call this method to send a packet you have constructed to a node with destAddr n How do I know the destination’s address? n Fishnet assign the lowest unused address (0-254) to a newly started node n If you start two fish nodes, they will have address 0 and 1Node.java n onCommand(String command)! n entry point for node commands, process commands here n Example: 0 hello n Node 0’s onCommand gets invoked with command = “hello”Node.java n onReceive(Integer from, byte[] msg)! n Entry point for receiving a packet n However, put your support for new protocols in receivePacket(int from, Packet packet)! n receivePacket(int from, Packet packet)! n Call your protocol specific packet processing code from this methodNode.java n addTimer n An example of how to use callbacks and timers n You may need to implement more sophisticated versions of it, since the current one only adds callbacks with no argumentsInteroperable Designs n You should stick to the protocol and API specification on course webpage n Connection setup n Connection tear-down n You are free to choose how you implement the specification n You are free to build your own test case (other than the sample transfer client/server)!Interoperable Designs n We provide an example design sketch n Classes view Node TCPManager: manage multiple TCP sockets TransferClient: client thread TransferServer: server thread TCPSock: Implementing TCP socket manage use use use On Command “transfer” On Command “server”How to test your code? n Use the “two.topo” file on course website to setup two directly connected nodes (with addresses 0 and 1)! n In your “server” command, specify the port to listen on, and backlog n In your “transfer” command, specify the destination node address and port, and the amount to transfer n Or, use the simulator scripts “transfertest.fish” under the “scripts”
View Full Document