You are on page 1of 3

EECE3140 Data Communications – R&A

Lab 4: FTP Client

Objectives
After completing the lab, you should have a better understanding of the requirements for
implementing a data communications protocol.

Introduction
The File Transfer Protocol (FTP) is used to transfer files from a client (your pc) to a server over
a TCP\IP network such as the internet. The FTP server is a piece of software that runs on a
computer and waits for client requests. Typically, an FTP server is used to allow file sharing
between users. To access files on an FTP server, you need a user id and a password. Some FTP
servers allow you to login as “anonymous“, and don’t require a password. Even though an FTP
server may require a userid and password, the data is not encrypted. This makes it possible for
someone else to capture data traffic and see what you are sending. Because of this, it is not
popular today. You can still find sites on the internet that use it, typically education institutions.
Some industrial equipment still uses it. The Staubli robot controller is an FTP server. When you
transfer a program from the computer to the controller, it is done using FTP.

FTP Server
The server name is vmloki.conestogac.on.ca. You can also use the IP address 142.156.151.190.
Your login should be the following.
UserID: Your Novell login (e.g. jsmith-cc)
Password: "Cc"followed by your student number (.e.g. Cc1234567)
If you cannot login, contact your instructor cdobson@conestogac.on.ca

Document List
There are a number of documents on the labs web page. They are there to help clarify FTP (I
hope).
An Overview of the File Transfer Protocol – is a introduction, containing some general
information.
FTP Session Sequence Diagram – shows the sequence of packets sent and received for a couple
of the FTP commands.
Command line commands for Microsoft FTP Client – describes the commands you type in when
using the client. You should try most of these to get familiar with how they work. You will have
to implement some of them in your client.
FTP Client Commands – these are the actual command strings sent from the client to the server.
They are slightly different from the command line commands.
Also, there is always the internet.....

Software List
Wireshark – is packet capture software you can run to examine the contents of packets that you
send to/receive from the server.
FTPClient Template – is a C programming project that has been setup for you as a starting point.

FTP Client Lab.docx Page 1 of 3


EECE3140 Data Communications – R&A

Procedure
1. Using the Microsoft FTP client.
The first step is to become familiar with the Microsoft FTP client. To run the client, open a
command window, and type ftp.
The program will start, and you will know it is running because the prompt with change to

ftp>

If you do not see the prompt, the program is not running.

To login to the server type the following,

open vmloki.conestogac.on.ca

The following response will be sent by the server,

Connected to vmloki.conestogac.on.ca.
220 (vsFTPd 2.0.5)
User (vmloki.conestogac.on.ca:(none)):

Enter your user id. The server will respond with,

331 Please specify the password.


Password:

Enter your password. If both are correct, the server will respond with,

230 Login successful.


fpt>

If your login was not successful, the server will respond with,

530 Login incorrect.


Login failed.
ftp>

Once you have logged in, spend some time becoming familiar with the ftp commands. A list of
these can be found on the web pages (Command line commands for Microsoft FTP Client).
Typing help at the ftp> prompt will display a list of commands. Typing the help command
will display a very brief description of what the command is used for. For example,

help open
open Connect to remote tftp

If you wish to see what is happening at the packet level, download Wireshark to capture the
packets.

FTP Client Lab.docx Page 2 of 3


EECE3140 Data Communications – R&A

2. Writing your own FTP client.


First download and compile the FTPClient Template. The following commands have been
implemented for you.
open – opens a connection to the server and allows you to enter your login information.
pwd – prints the working directory on the server.
bye – disconnects from the server and exits the program.

Be sure the client can execute the above commands before proceeding.

Next, you will implement 5 more FTP commands. These are,

mkdir – make directory


cd – change directory
rmdir – remove directory
rename – rename a file*
delete – delete a file*

*Since you do not have to implement sending a file to the server, you can send one using the
Microsoft client, then rename and delete using your client.

FTP uses Windows Sockets (WinSock). The template sets up a connection socket for you, and
the SendData() and ReceiveData() functions handle the socket requirements for sending and
receiving. You do not have to know the exact details to complete this lab. If you attempt the
bonus, those details will become important.

Program Design
Spend some time with the template you have been given so you understand how it works.
Determine where you will add your code (Hint: where are the other commands called?).
It would be a good idea to have a separate function for each command, and call them from the
main function. The pwd command is a good example to follow.

Testing your program


Your program should do basically the same thing as the Microsoft client. Again, you can use
WireShark to examine the FTP packets if you wish.

Demonstration and Lab Report


Demonstrate to your instructor. Deposit the .exe file. Hand in a printout of the code.
Each function from the above list implemented – 2 marks

Bonus - wow
Implement the dir command – 2 marks
Implement the put command – 2 marks
Implement the get command – 2 marks

FTP Client Lab.docx Page 3 of 3

You might also like