Search code examples
ftpsimulationomnet++inet

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


I want to create a FTP connection and send a big file via it and see its effect in my network. In order to do that, I wrote the following lines in OMNet++ scenario file. I am not sure whether this is a correct way of creating a FTP connection or not. I set "thinkTime" and "IdleInterval" parameters to zero to send the FTP data immediately and in one session. Since the file size is too big for my current simulation, I think I would have only one session through the whole simulation time. However the throughput of my FTP connection is too low and I am not sure. Can someone help me? All suggestions or FTP examples are welcome.

# 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

Solution

  • Since FTP uses TCP in transport layer, we can use "TCPBasicClientApp" and "TCPGenericSrvApp" for FTP client and server respectively. For simulating behavior of FTP protocol, we set the port to 21. In addition, for simulation upload and download scenario, you just need to change the size of request length and reply length. As an example, please take a look at codes below;

    # 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
    

    As you can see, I set "idleInterval" abd "thinktime" to zero. With these values, you can be sure that you have a constant transmission of FTP packets during your simulation time.