Skip to content
My FTP Implement
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



  • Implement according to RFC 959
  • C3K~C4K
  • Should use sudo to run this FTP server, for that it use operating system's accout login mechanism.
  • Develop and test on linux kernel >= 4.10 (debian series), so I don't know whethere it will work fine at other kernel or operating system.
  • Does NOT support the authority control. Because that I use threadPool but the posix's setuid and syscall(SYS_setuid, uid) don't support setting other thread's uid(If you know how to do it, please tell me. Thank you!).



  • Test include
    • login
    • list a dir
    • upload 100KB files


  • First, run the FTP server

    ulimit -s unlimited -f unlimited -d unlimited -n unlimited 
    su root
    echo 20000 >  /proc/sys/net/core/somaxconn
    sudo ./FTPServer [port]  > /tmp/FTPServerOutput

    Redirect the stdout to /tmp/FTPServerOutput is for the clear output of warning msg

    Change somaxconn is to make the backlog large enough.

    The sudo is because that it use operating system's accout login mechanism

    The [port] param of ./FTPServer [port] is not necessary, which means sudo ./FTPServer > /tmp/FTPServerOutput, this will listen on 8001

  • Then run java -ea -jar -Dexternal.config=file:/tmp/ FTPServerTester-1.0-SNAPSHOT.jar

    FTPServerTester-1.0-SNAPSHOT.jar is in the test dir (NOT src/test

    /tmp/ is config file, the example is below

    # the time(millisecond) to hand on the connection
    # the host that you run the ftp server
    # the host that you run the tester
    # MUST make sure that this two host can connect to each other,
    # which means, they can active connection to each other.
    # The username of account in your OS
    # The password of account in your OS
    # These dir MUST be absoute path
    # this is the list of dirs that split by comma
    # This dir's cnt should >=20, the more, the better, 
    # if too less, the test will be very slow, for that many client read the same dir is very slow
    # These dir should exist in your testServer, if the server and testProgram run on different host
    # if they run in the same host, then the testProgram will create these dir
    # this is one dir 
    # This MUST be absoute path 
    # This dir should exist in your testServer, if the server and testProgram run on different host
    # if they run in the same host, then the testProgram will create this dir


  • My tester and server run in same machine.
  • In my computer(Intel i7-8550U, 16G memory, no SSD), when the StressTest.MaxCmdConnectionCnt below 10240, the test will run success, and using linux's ftp command to communicate with the server while run the test, it response fast.
  • If set the tester as follows
    then use sudo watch -n 0.5 "netstat -anp | grep -i <PID> | grep -i "est" | wc -l ", the connections number is 3K~4K. And communicate with the server using ftp command while running tester, its response is not slow.
You can’t perform that action at this time.