如何在OMNeT ++中创建FTP连接并发送文件

时间:2018-07-24 15:38:01

标签: ftp simulation omnet++ inet

我想创建一个FTP连接并通过它发送一个大文件,并在我的网络中查看其效果。为此,我在OMNet ++方案文件中编写了以下几行。我不确定这是否是创建FTP连接的正确方法。我将“ thinkTime”和“ IdleInterval”参数设置为零,以在一个会话中立即发送FTP数据。由于文件大小对于我当前的模拟来说太大,我认为整个模拟时间内只有一个会话。但是,我的FTP连接的吞吐量太低,我不确定。有人能帮我吗?欢迎所有建议或FTP示例。

# FTPclusterMember FTP
**.clusterMember[0].tcpApp[1].typename = "TCPBasicClientApp"
**.clusterMember[0].tcpApp[1].connectAddress = "FTPserver"
**.clusterMember[0].tcpApp[1].connectPort = 21
# Download Scenario requestLength < replyLength
**.clusterMember[0].tcpApp[1].requestLength = 100B 
**.clusterMember[0].tcpApp[1].replyLength = 1500MB 
**.clusterMember[0].tcpApp[1].thinkTime = 0s
**.clusterMember[0].tcpApp[1].idleInterval = 0s

# FTPserver Settings
**.FTPserver.numTcpApps = 1
**.FTPserver.tcpApp[0].typename = "TCPSinkApp" 
**.FTPserver.tcpApp[0].localAddress = "FTPserver"
**.FTPserver.tcpApp[0].localPort = 21

1 个答案:

答案 0 :(得分:0)

由于FTP在传输层中使用TCP,因此我们可以分别对FTP客户端和服务器使用“ TCPBasicClientApp”和“ TCPGenericSrvApp”。为了模拟FTP协议的行为,我们将端口设置为21。此外,对于模拟上载和下载方案,只需更改请求长度和答复长度的大小即可。例如,请看下面的代码;

# FTPclusterMember FTP
**.clusterMember[0].numTcpApps = 1
**.clusterMember[0].tcpApp[0].typename = "TCPBasicClientApp"
**.clusterMember[0].tcpApp[0].connectAddress = "FTPserver"
**.clusterMember[0].tcpApp[0].connectPort = 21
# Download Scenario requestLength < replyLength
# Upload Scenario requestLength > replyLength
**.clusterMember[0].tcpApp[0].requestLength = 1500MB 
**.clusterMember[0].tcpApp[0].replyLength = 100B   
**.clusterMember[0].tcpApp[0].thinkTime = 0s
**.clusterMember[0].tcpApp[0].idleInterval = 0s

# FTPserver Settings
**.FTPserver.numTcpApps = 1
**.FTPserver.tcpApp[0].typename = "TCPGenericSrvApp" 
**.FTPserver.tcpApp[0].localAddress = "FTPserver"
**.FTPserver.tcpApp[0].localPort = 21

如您所见,我将“ idleInterval”和“ thinktime”设置为零。使用这些值,可以确保在仿真期间不断传输FTP数据包。