在inet下写一个“HelloWorld”程序
写在最前
由于要用别人的项目代码来进行仿真,却不知道如何新建一个项目来跑自己的网络,故写下这篇文章。在inet的基础上,运行一个example上的例子。
新建omnet++项目
新建test项目,empty project,之后直接按finish即可。
引用inet项目
对project 右键,properties。
新建ned
package tcptest;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
import ned.DatarateChannel;network net1
{parameters:@display("bgb=400,200");submodules:router: Router {parameters:@display("p=200,100;i=abstract/router");gates:pppg[2];}client: StandardHost {parameters:@display("p=50,100");gates:pppg[1];}server: StandardHost {parameters:@display("p=350,100;i=device/server");gates:pppg[1];}configurator: IPv4NetworkConfigurator;connections:router.pppg[0] <--> NormalPath <--> client.pppg[0];router.pppg[1] <--> NormalPath <--> server.pppg[0];
}channel NormalPath extends DatarateChannel
{parameters:datarate = 100Mbps;delay = 0.0565us; // 10mper = 0;ber = 0;
}
新建.ini配置文件
[General]
network = net1warnings = true
sim-time-limit = 2.1scmdenv-module-messages = true # for normal (non-express) mode only
cmdenv-event-banners = true # for normal (non-express) mode onlytkenv-plugin-path = ../../../etc/plugins#
# Network specific settings
## set inet_addr, Mask, MTU ( = 1500), default route (=router)
#**.client.routingTable.routingFile = "client.mrt"
#**.router.routingTable.routingFile = "router.mrt"
#**.server.routingTable.routingFile = "server.mrt"# ip settings
**.ip.procDelay = 0s
**.forwarding = false# hookType settings
**.ppp[*].numOutputHooks = 1
**.ppp[*].outputHook[0].typename = "OrdinalBasedDropper" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator# ARP settings
**.arp.retryTimeout = 1s
**.arp.retryCount = 3
**.arp.cacheTimeout = 100s# NIC settings
**.ppp[*].queueType = "DropTailQueue"
**.ppp[*].queue.frameCapacity = 100 # packets# tcp apps - client
**.client.numTcpApps = 1
**.client.tcpApp[*].typename = "TCPSessionApp" # FTP
**.client.tcpApp[*].sendBytes = 100MiB
**.client.tcpApp[*].active = true
#**.client.tcpApp[*].localAddress = "172.0.0.1"
**.client.tcpApp[*].localPort = 10020
**.client.tcpApp[*].connectAddress = "server"
**.client.tcpApp[*].connectPort = 10021
**.client.tcpApp[*].tOpen = 0s
**.client.tcpApp[*].tSend = 0s
**.client.tcpApp[*].tClose = 0s
**.client.tcpApp[*].sendScript = ""# tcp apps - server
**.server.numTcpApps = 1
**.server.tcpApp[*].typename = "TCPSinkApp"
#**.server.tcpApp[*].localAddress = "172.0.1.111"
**.server.tcpApp[*].localPort = 10021# tcp settings
**.tcp.advertisedWindow = 65535 # in bytes, corresponds with the maximal receiver buffer capacity (Note: normally, NIC queues should be at least this size)
**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = true # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 500 # Maximum Segment Size (RFC 793) (header option)
**.tcp.tcpAlgorithmClass = "TCPReno" # TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl/DumbTCP
**.tcp.recordStats = true # recording of seqNum etc. into output vectors enabled/disabled# pcapRecorder settings
**.numPcapRecorders = 1#
# Config specific settings
## Examples from [RFC2018]:
# "Assume the left window edge is 5000 and that the data transmitter
# sends a burst of 8 segments, each containing 500 data bytes." [RFC2018][Config One]
description = "RFC_2018_Case_1"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_1_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_1_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "17;18;19;20;"
# "Case 1: The first 4 segments are received but the last 4 are
# dropped.
#
# The data receiver will return a normal TCP ACK segment
# acknowledging sequence number 7000, with no SACK option." [RFC2018][Config Two]
description = "RFC_2018_Case_2"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_2_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_2_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "13;"
# "Case 2: The first segment is dropped but the remaining 7 are
# received.
#
# Upon receiving each of the last seven packets, the data
# receiver will return a TCP ACK segment that acknowledges
# sequence number 5000 and contains a SACK option specifying
# one block of queued data:
#
# Triggering ACK Left Edge Right Edge
# Segment
#
# 5000 (lost)
# 5500 5000 5500 6000
# 6000 5000 5500 6500
# 6500 5000 5500 7000
# 7000 5000 5500 7500
# 7500 5000 5500 8000
# 8000 5000 5500 8500
# 8500 5000 5500 9000" [RFC2018][Config Three]
description = "RFC_2018_Case_3"
**.client.pcapRecorder[0].pcapFile = "RFC_2018_Case_3_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2018_Case_3_Server_Log.pcap"
**.client.ppp[*].outputHook[0].dropsVector = "14;16;18;20;"
# "Case 3: The 2nd, 4th, 6th, and 8th (last) segments are
# dropped.
#
# The data receiver ACKs the first packet normally. The
# third, fifth, and seventh packets trigger SACK options as
# follows:
#
# Triggering ACK First Block 2nd Block 3rd Block
# Segment Left Right Left Right Left Right
# Edge Edge Edge Edge Edge Edge
#
# 5000 5500
# 5500 (lost)
# 6000 5500 6000 6500
# 6500 (lost)
# 7000 5500 7000 7500 6000 6500
# 7500 (lost)
# 8000 5500 8000 8500 7000 7500 6000 6500
# 8500 (lost)" [RFC2018]# Examples from [RFC2883]:
#
# "Reporting Full Duplicate Segments
#
# We illustrate these guidelines with three examples. In each example,
# we assume that the data receiver has first received eight segments of
# 500 bytes each, and has sent an acknowledgement with the cumulative
# acknowledgement field set to 4000 (assuming the first sequence number
# is zero). The D-SACK block is underlined in each example." [RFC2883][Config Four]
description = "RFC_2883_Example_1"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_1_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_1_Server_Log.pcap"
**.tcp.advertisedWindow = 1000
**.server.ppp[*].outputHook[0].dropsVector = "8;9;"
# "Example 1: Reporting a duplicate segment.
#
# Because several ACK packets are lost, the data sender retransmits
# packet 3000-3499, and the data receiver subsequently receives a
# duplicate segment with sequence numbers 3000-3499. The receiver
# sends an acknowledgement with the cumulative acknowledgement field
# set to 4000, and the first, D-SACK block specifying sequence numbers
# 3000-3500.
#
# Transmitted Received ACK Sent
# Segment Segment (Including SACK Blocks)
#
# 3000-3499 3000-3499 3500 (ACK dropped)
# 3500-3999 3500-3999 4000 (ACK dropped)
# 3000-3499 3000-3499 4000, SACK=3000-3500
# ---------" [RFC2883][Config Five]
description = "RFC_2883_Example_2"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_2_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_2_Server_Log.pcap"
**.tcp.advertisedWindow = 2000
**.client.ppp[*].outputHook[0].dropsVector = "11;"
**.server.ppp[*].outputHook[0].dropsVector = "8;9;10;"
# "Example 2: Reporting an out-of-order segment and a duplicate
# segment.
#
# Following a lost data packet, the receiver receives an out-of-order
# data segment, which triggers the SACK option as specified in RFC
# 2018. Because of several lost ACK packets, the sender then
# retransmits a data packet. The receiver receives the duplicate
# packet, and reports it in the first, D-SACK block:
#
# Transmitted Received ACK Sent
# Segment Segment (Including SACK Blocks)
#
# 3000-3499 3000-3499 3500 (ACK dropped)
# 3500-3999 3500-3999 4000 (ACK dropped)
# 4000-4499 (data packet dropped)
# 4500-4999 4500-4999 4000, SACK=4500-5000 (ACK dropped)
# 3000-3499 3000-3499 4000, SACK=3000-3500, 4500-5000
# ---------" [RFC2883][Config Six]
description = "RFC_2883_Example_3"
**.client.pcapRecorder[0].pcapFile = "RFC_2883_Example_3_Client_Log.pcap"
**.server.pcapRecorder[0].pcapFile = "RFC_2883_Example_3_Server_Log.pcap"
**.client.ppp[*].numOutputHooks = 2
**.client.ppp[*].outputHook[0].typename = "OrdinalBasedDropper" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator | ...
**.client.ppp[*].outputHook[0].dropsVector = "11;"
**.client.ppp[*].outputHook[1].typename = "OrdinalBasedDuplicator" # Nop | ThruputMeter | OrdinalBasedDropper | OrdinalBasedDuplicator | ...
**.client.ppp[*].outputHook[1].duplicatesVector = "12;"
# "Example 3: Reporting a duplicate of an out-of-order segment.
#
# Because of a lost data packet, the receiver receives two out-of-order
# segments. The receiver next receives a duplicate segment for one of
# these out-of-order segments:
#
# Transmitted Received ACK Sent
# Segment Segment (Including SACK Blocks)
#
# 3500-3999 3500-3999 4000
# 4000-4499 (data packet dropped)
# 4500-4999 4500-4999 4000, SACK=4500-5000
# 5000-5499 5000-5499 4000, SACK=4500-5500
# (duplicated packet)
# 5000-5499 4000, SACK=5000-5500, 4500-5500
# ---------" [RFC2883]# References
#
# [RFC2018] Mathis, M., Mahdavi, J., Floyd, S. and Romanow, A., "TCP
# Selective Acknowledgment Options", RFC 2018, October 1996.
#
# [RFC2883] Floyd, S., Mahdavi, J., Mathis, M. and Podolsky, M., "An
# Extension to the Selective Acknowledgement (SACK) Option
# for TCP", RFC 2883, July 2000.
build project
搞定
水了篇博客,跟自己做人一样
在inet下写一个“HelloWorld”程序相关推荐
- helloworldjava_Java语言入门-第一个HelloWorld程序
1.官网下载Jdk 1.1 打开之后出现如下界面: 1.2选择对应版本:这里选择Jdk8版本. 最新的不一定是最好的,稳定才是王道. 2.安装 2.1 双击安装包打开,点击下一步. 2.2 点击更改路 ...
- 学了C语言,如何利用CURL写一个下载程序?—用nmake编译CURL并安装
在这一系列的前一篇文章学了C语言,如何为下载狂人写一个磁盘剩余容量监控程序?中,我们为下载狂人写了一个程序来监视磁盘的剩余容量,防止下载的东西撑爆了硬盘.可是,这两天,他又抱怨他的下载程序不好用,让我 ...
- [WinForm]写一个小程序把指定目录的程序添加到开机自动启动(无法绕过360检查)
网友阿东提示了这样一个需求:写一个小程序把指定目录的程序添加到开机自动启动,跳过360 我就到百度上搜了一下:C# 将程序添加到启动项 (写入注册表),及从启动项中删除 - 赤狐(zcm123) - ...
- 从0开始写一个小程序
项目简介 从0开始写一个小程序,本来想写一个新闻类的程序,后来发现调用的聚合数据api每天只能访问100次,就换成豆瓣的了,直接用豆瓣的接口又访问不了,在网上查了一下,要把豆瓣的地址换成"h ...
- 一、SpringMVC基础入门,创建一个HelloWorld程序
一.SpringMVC基础入门,创建一个HelloWorld程序 1.首先,导入SpringMVC需要的jar包. 2.添加Web.xml配置文件中关于SpringMVC的配置 1 2 3 4 5 6 ...
- linux应用程序的编写实验原理,操作系统实验 1.在linux下编写一个应用程序 联合开发网 - pudn.com...
操作系统实验 所属分类:Linux/Unix编程 开发工具:C/C++ 文件大小:1KB 下载次数:3 上传日期:2019-05-01 20:34:21 上 传 者:烟雨南风起 说明: 1.在lin ...
- python抽奖游戏_利用Python写一个抽奖程序,解密游戏内抽奖的秘密
原标题:利用Python写一个抽奖程序,解密游戏内抽奖的秘密 前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 极客 ...
- 在Android studio里写一个Flutter程序
在Android studio里写一个Flutter程序 前言 前言 新建一个Flutter工程,选择Flutter Application 选择Flutter 同时配置Flutter sdk路径 n ...
- python抽奖教程_利用Python写一个抽奖程序,解密游戏内抽奖的秘密|python基础教程|python入门|python教程...
https://www.xin3721.com/eschool/pythonxin3721/ 分析需求 我们先整理下思路,目标是什么?目标是要写一个抽奖程序,那么抽奖程序的核心是什么?当然是如何判断一 ...
最新文章
- iOS蓝牙4.0开发例子
- R语言distMeeus函数计算大圆距离实战(Great Circle Distance)
- 阿酷快捷键怎么使用_必须收藏!Linux用户必须知道的常用终端快捷键
- matlab2c使用c++实现matlab函数系列教程-cosh函数
- 暑假集训 div1 B Derangement 交换数字 思维死角
- h2 mysql mode_H2 数据库快速入门
- zoj1134 Strategic Game(DP/图论)
- L1-037 A除以B (10 分)—团体程序设计天梯赛
- 基于OpenMV的图像识别之数字识别
- iOS Safari扩展开发构建版本时出现的常见问题的解决方法
- postman使用之Tests使用
- JAVA-----集合子接口Queue及其子接口Deque
- Qt3升至Qt4需要注意的几件事项浅谈
- 既然彼此不能相濡以沫, 那就相忘于江湖吧.
- 自己定义jquery插件轮播图
- Java面试宝典-2017
- 天文学论文写作时需要注意的点
- UTC时间转换为当前时区时间
- 微信屏蔽拼多多小红书等外链,连带屏蔽QQ音乐,连自家兄弟也不放过!
- 【Android】之屏幕适配
热门文章
- 自学python要看哪些书-想学习Python做数据分析,应该看哪些书?
- python与excel-超简单:用Python让Excel飞起来
- 零基础学python好学吗-想要0基础学python要怎么做?python好学吗?
- python使用缩进来体现-Python 使用缩进来体现代码之间的逻辑关系 .
- python编程案例教程-Python程序开发案例教程
- 浅谈语音识别技术的发展趋势与应用前景
- 传统语音识别(GMM+HMM)
- python绘制动态条形图_Python 绘图与可视化 matplotlib 动态条形图 bar
- jsch 长连接_广濑连接器DF13
- Vuex的State核心概念