$30
In this project, you will implement a file transfer application based on TCP_ The server is a concurrent server that can handle multiple file transfer sessions. The client can both upload files to and download files from the server. In addition, the client can request the change of directory and list the files in a given directory. Figure 1 shows the PDU format to be used in the implementation_
size of the Data field_ The data field contains the data, there are eight PDU types_
· .1-ype - — This PDU is sent by the client to request a file download. The Data field
contains the file name and the length field indicates the length of the name_
· Type — This PDU is sent by the client to request a file upload. The Data field contains
the file name and the length field indicate the length of the name.
§ Type 'R.' — This PDU is sent by the server to indicate that it is ready
· Type 'F' — This PDU contains the file data. The length field indicates the size of the file.
· Type *E' — This PDU is used to report error. The Data field contains the error message and the length field indicates the size of the message_
· Type .P' — This PDU is sent by the client to request the change of directory_ The Data field contains the directory path name
· Type — This PDU is sent by the client to request the list of files in a given directory.
The Data field contains the directory path name
· Type — This PDU is sent by the server_ The data field contains the list of file names_
Flow Diagrams
Figures 2, 3, 4, 5 and 6 show the PDLT exchange scenarios for the file download, file upload, error reporting, change directory and list directory, respectively.
TCP Server
Client
.40
PDU(0.1ength.filename)
PDU(F.length.Data)
Fig 2: File Download
Client
TCP Server
- _ _
PD U(U,Iength,filename)
•
PDU(R,O)
PDU(F,length,Data)
•
- -
Fig 3: File Upload
Client
TCP Server
PDU(UID.Iength,filename)
PDU(Elength,message)
Fig 4: Error Reporting
Server
Change directory
Server
Client TCP
PDU(P,length,dir_path)
-----a.
------4
4------- —
PDU(R,0—
Fig 5: Change directory
Client
TCP
----____
POU(L,Iength,dir_path)
-----III■
_...--
PDU(1,1ength,list_of_files) .4------
Fig 6: List Directory