Manually commanded ftp client (Python interactive prompt)
Making this way of connecting to ftp server my aim was to understand how an ftp client works in a low level. You can see the process as you do it step by step.
There are two channels in the ftp connection: first, the command channel (default port: 21), secondly, the data channel (no default port, the port number is generated by the server again and again), where the server send the data. Therefore you need to create and connect more sockets in order to grab or send a file.
The commands are binaries (b'...\r\n'), following the standards. The receiving puffer size can be other.
Testing with vsftpd ftp server daemon, you need to give permission for anonymous login. $ sudo nano /etc/vsftpd.conf Change NO to YES on the proper line: Allow anonymous FTP? (Disabled by default). anonymous_enable=YES
The test file ('test.txt') is located in /srv/ftp directory, the default directory of vsftpd, with the text: 'this is the content of the test file for testing manually commanded python ftp client\n' (as you will see at the end of the process, below).
Open the py file ('manually_commanded_ftp_client.py', the extension is py in order the repository to show the Python genre), follow the instructions and enjoy the process!