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

How to create a FTP connection and send a file in OMNeT++

我想创建一个 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

由于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" abd "thinktime" 设置为零。使用这些值,您可以确保在模拟时间内持续传输 FTP 个数据包。