Linux Internals Projects for Beginners | Trivial File Transfer Protocol
Linux Internals Projects for Beginners | Trivial File Transfer Protocol
About this project
The goal of this project is to implement Trivial File Transfer Protocol (TFTP) between two given machines in the network.
About this project
TYPE | Individual project |
DIFFICULTY | Advanced |
ESTIMATED TIME | 50 hours |
PUBLISHED | 15th March, 2021 |
CONTACT | training@emertxe.com |
Introduction
Trivial File Transfer Protocol (TFTP) is a simple, File Transfer Protocol which allows a client to get from or put a file onto a remote host. One of its primary uses is in the early stages of nodes booting from a local area network. TFTP has been used for this application because it is very simple to implement.
This protocol doesnโt support advanced features that is there in FTP. User authentication, directory-listing features are not supported by this protocol. This implementation is done with simplicity and user-friendliness as main focus. TFTP was first standardized in 1981 and the current specification for the protocol can be found in RFC 1350. This is used to transfer files between two machines in a secure environment where the authentication is not required.
In TFTP implementation, the server runs infinitely in a loop. The client runs till the user types โbyeโ in the prompt. Once a new process is forked the new port where the server is waiting should be informed to the client. That is automatically done when the server responds to the clientโs request. In this implementation the new port starts from 20000 and for each connection the port number is increased. By doing this the port numbers are unique and the clients will have unique port numbers for contacting the server.
Requirement Details
Here is the list of requirements that need to be implemented in this project.
- Server must run in background without any user interface.
- Client should provide a prompt to user (like default TFTP client). User can use commands to connect to server, get/put file and exit.
- Following are the commands:
- connect โ To send connect request to server (IP Address)
- get โ To receive a file from server (file name)
- put โ To send a file to server (file name)
- mode โ To set mode of transfer (octet, netascii or mail)
- Bye/quit โ Close the connections and exit from client
Skeleton Code
The skeleton code in a very interesting concept used in Emertxe. By looking into the skeleton code, you will get a clear picture into converting the given requirement into a working solution. This will also take care of important aspects like modularity, clean coding practices, re-usability etc.
Sample Output
Here are the sample output expected by the end of project execution.
Fig1: Server running in background
Fig2: Application usage. Help menu
Fig3: Establishing the connection with server. File transfer to Server using put command
Fig4: Creating a dummy file in server. Establishing the connection with server via command line argument. Receiving the file from the server
Fig5: Some possible Error Handling