Beruflich Dokumente
Kultur Dokumente
Assignment
Contents
Acknowledgement .......................................................................................................................... 2
Introduction ..................................................................................................................................... 3
Internet Protocol Suite .................................................................................................................... 3
Internet Protocol.............................................................................................................................. 3
Transmission Control Protocol ....................................................................................................... 4
The FTP File Transfer Program ...................................................................................................... 5
Features involved in the program ................................................................................................... 8
Upload File.................................................................................................................................. 8
Browsing for file ......................................................................................................................... 9
Connect to IP Address .............................................................................................................. 10
Conclusion .................................................................................................................................... 12
Page 1
Assignment
Acknowledgement
I would like to thank Mr. Muhammad Ibrahim Ravi, who is my lecturer for Distributed
Computing module, to give me the opportunity to complete this assignment, in which I have
learnt many new methods and experiences while developing the file transfer program. This
allows me to further my experience in developing programs which uses Remote Method
Invocation (RMI) and Transmission Control Protocol (TCP).
Page 2
Assignment
Introduction
The assignment is to create a File Transfer program which uses an FTP server and client. This
program also uses RMI and TCP sockets in uploading and downloading the files from server to
client. In the file transfer program, the user is able to search for a file and upload the file, or
download the file from the server.
Internet Protocol
-
Is the principle communications protocol used for relaying datagrams which are also
known as packets across an internetwork using the Internet Protocol Suite.
It is also in charge of routing the packets across network boundaries which makes it the
primary protocol that establishes the Internet.
Is the primary protocol in the Internet layer of the Internet protocol suite
Delivers datagrams from the source host to the destination host based only on their
addresses.
Page 3
Assignment
Page 4
Assignment
Connect function
Upload function
Download function
Main Frame
Main Frame
The main frame is the start frame of the program, in which when the program is started, the
program will load the main page first. The main page also allows the user to select whether the
user wants to upload the file or download the file.
Bsc(Hons) In Software Engineering
Page 5
Assignment
The upload file frame is a section of the program in which the user is able to connect their IP
address and port number, and upload items to the server. The upload section allows the user to
search for a specific file, and upload the file to the server. The file search only searches for
specific files which are either JPG, JPEG, GIF, TXT and PNG only, in which these files are only
allowed to be uploaded into the server.
Page 6
Assignment
The download file frame is a section in the program in which the user is able to connect their IP
address and the port number to the server to view and download files into the server. The
download section lists files down in a table, and allows the users to select and download the
specific file.
Page 7
Assignment
Based on the code above, the upload file button calls the send file function, in which the send file
function gets the file path from the textbox, and using the File import function, stores the file
path with the File. When the file is uploaded, the program will display a message that the file has
been uploaded. If the file is repeated, or has the same file name, a message dialog box will
appear stating that the file has already been uploaded before in the system. If the file path does
not exist, the program will display a message dialog box stating that the file does not exist.
Page 8
Assignment
Based on the above code snippet, the browse file button allows a open dialog to display the files
so that the user is able to select the file to be uploaded into the server. The file selected will then
be listed into the file name textbox, while the file path will be listed in the file path textbox.
Page 9
Assignment
Connect to IP Address
Based on the code above, the connect function connects the socket with the IP address and the
port number, in which the object output stream and the object input stream is linked with the
socket. When the server is connected, the program will display a message which states it is
connected to the server.
Page 10
Assignment
Download File
Based on the code above, the download file button invokes the receiveFile method in which the
receiveFile method gets the selected row of the table, and gets the index of the table based on the
file name which is selected, and then downloaded the file into the path which is defined in File f.
After the file has been downloaded, the system prints out a message that the file has been
downloaded, and close the buffer output stream.
Page 11
Assignment
Conclusion
During the progression of this assignment, I as the developer had learnt many new java
programming codes related to Remote Method Invocation (RMI) and Transmission Control
Protocol (TCP). Besides that, I also have learnt on how many different methods to upload files
and download files, as well as connect the client side to the server side.
Page 12