⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 计算机网络中的几个简单协议的仿真代码
💻
字号:
This package contains a simulator for simulating datalink protocols, andcodes for simulating the protocols of Chapter 3 of "Computer Networks 4/e"by Andrew S. Tanenbaum, published by Prentice Hall PTR, 2002. It was writtenby Andrew S. Tanenbaum and revised by Shivakant Mishra. It may be freelydistributed.This package may be used in two ways: (1) using X window-based graphicaluser interface, and (2) using the Unix/Linux command-line interface.To use the X window-based graphical user interface, you need to have Xwindow system and Tcl/Tk toolkit installed on your system. Simply run thescript file gui.tcl to start the graphical user interface. You may haveto modify the first line of this file to reflect the correct path forwish in your system. You can compile and run the simulator and the datalinkprotocols using this interface.To use the Unix/Linux command-line interface, a makefile is provided thatcompiles the simulator and all five protocols.  To use this, just type'make'.  If you want to use gcc instead of cc,change the lineCC=cctoCC=gccin Makefile.If you don't have make installed on your system, you can compile thesimulator and the protocols individually. The simulator code is in filesimulator.c with header file simulator.h, and files p2.c, p3.c, p4.c, p5.c,and p6.c provide the protocol codes for the datalink protocols described inchapter 3. Compile the simulator as follows:	gcc -c simulator.cThis will create an object file called simulator.o that needs to be linkedwith the protocol being simulated. Compile the protocols as follows:        gcc -o protocol-name protocol-filename.c simulator.oFor example, to compile p6.c, use the following command:	gcc -o protocol6 p6.c simulator.oThis protocol can then be executed as follows:	protocol6 events  timeout  pct_loss  pct_cksum  debug_flagswhere        events tells how long to run the simulation        timeout gives the timeout interval in ticks        pct_loss gives the percentage of frames that are lost (0-99)        pct_cksum gives the percentage of arriving frames that are bad (0-99)        debug_flags enables various tracing flags:                1        frames sent                2        frames received                4        timeouts                8        periodic printout for use with long runsFor example	protocol6 100000 40 20 10 3will run protocol 6 for 100,000 events with a timeout interval of 40 ticks,a 20% packet loss rate, a 10% rate of checksum errors (of the 80% that getthrough), and will print a line for each frame sent or received.  Becauseeach peer process is represented by a different UNIX process, there is(quasi)parallel processing going on.  This means that successive runs willnot give the same results due to timing fluctuations.Protocol designers are advised to read file protocol.h. This file containsthe definitions of the data structures that the simulator uses, and adescription of the function prototypes that the simulator provides.A set of possible student exercises is given in the file exercises.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -