A concurrent File Transfer Protocol (FTP) server
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,215,236)
150 Accepted data connection
-rw-r--r-- 1 justinpage staff 10 May 20 13:28 message.md
drwxr-xr-x 3 justinpage staff 96 May 20 13:28 server
The Go Programming Language textbook offers a study of concurrency using CSP. One of the exercises, created as a challenge for the reader, is to implement a concurrent File Transfer Protocol (FTP) server. That is, a server that allows concurrent connections from multiple clients.
While not a complete implementation of RFC 959, this exercise provides
a survey of commands commonly used when interacting with an FTP server. This
includes cd
to change a directory, ls
to list a directory, get
to
send the contents of a file, put
to store the contents of a file, and many
more.
As is in the name, simple-ftp-server, I wanted to create a simple FTP server that could be digested by someone new to the language or looking to build their own FTP server. Much of the logic implemented is sequential and doesn't shy away from duplication as design.
You will need the latest stable version of go installed on your machine:
Run the following commands to download and build for execution:
git clone https://github.com/justinpage/simple-ftp-server.git
cd simple-ftp-server
go build -o server main.go
- Launch ftp server:
./server
- Connect:
ftp -P 8080 localhost
- Stop ftp server:
Control+C
to interrupt the process withSIGINT
- Thanks to D. J. Bernstein for his material on how FTP actually works
- Using the specification published in 1985 was an experience