(Solved Homework): hello guys. I need your help. I just learned python and I need a guidance for my programming projects….

hello guys. I need your help. I just learned python and I need a guidance for my programming projects.

—————————————————————————————————————————————–

Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): hello guys. I need your help. I just learned python and I need a guidance for my programming projects….
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay

This assignment must be done in Python 3

In this assignment, you will write a client and server application similar to FTP. The client connects to the server and can down-load any file accessible to the server application. Any number of files can be down-loaded and no access control is performed.

More specifically, the client initiates a control connection to the server port (the default port is #5000 if a port number is not given). All commands are sent over this connection. The client supported commands are: listget, and exit. The client will request a list of file names that are available on the server, (list of files in the same directory as the server.py file). The client can ‘get’ a file by entering ‘get filename.ext’. When the client requests to down-load a file using get, the server sends the requested file back. After the client receives the file and saves it to disk, the user should be able to issue another listget or exit command.

Additional requirements:

1.) The client will need to verify that it received the entire file. (Therefore, the server must let the client know the file size before sending it).

a.)The server message will be the in the following format:

‘sending filename.ext size (The size in bytes)’

2.) All connections must be properly closed when the client is finished, i.e. sends: exit.

3.)The server must be able to handle simultaneous requests from multiple clients. (Threads can be used)

4.)The client may ask for a file that the server cannot provide, so the client must be able to respond appropriately with an error message (since the client can obtain a list of files). (No crashing!)

5.)Do not assume a file size, i.e. send the file in chunks of 1024 bytes.

6.)Do not assume ‘localhost’.

7.)The client should put the received file in the same directory as the client.py file (The client.py file could be on a different host).

8.)Test your client and server with other students to see if you have made any assumptions.

9.)If your program does not completely work, it should not crash, the user should receive the message ‘Not Implemented Yet’.

10.) Do not hardcode any port numbers or IP addresses for the client. I should be able to provide the server and port number for the client side using command line arguments. Example: client.py 129.32.56.2 12001

11.)Do no hardcode any port numbers for the server. To run the program, I will type python3 server.py port_number (or python3 server.py) and python3 client.py ipaddress port_number

12.) Don’t do anything that would make your code specific to an operating system, such as windows pathnames, or Unix pathnames.

Submission Instructions:

1.)Turn in 3 files server.py, client.py and README.txt, zipped with your last_name.zip as the title of the assignment. DO NOT ADD ANYTHING ELSE TO THE ZIP FILE NAME.

2.)All functions and variables should have meaningful names.

3.)Use meaningful comments for functions

4.)I will place 3 files, .txt, .jpg, .png in the server directory when I unzip your submission. I will run the server and clients on different machines, so test your applications similarly. (Use Pickle to send objects back and forth, such as lists and non-string objects.)

5.)I will initiate several of your clients at the same time. You should test this also.

6.)The README.txt should:

a.)Let me know if your program is not fully implemented.

b.)Identify whether you developed the application on a Windows, MAC or Unix machine.

c.)Include specific instructions to type on the command line to run your program.

d.)Forewarn of any implementation issues

Expert Answer

pip install pyftpdlib

ftp-server.py:

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

authorizer = DummyAuthorizer()
authorizer.add_user("user", "12345", "/home/username", perm="elradfmw")
authorizer.add_anonymous("/home/username", perm="elradfmw")

handler = FTPHandler
handler.authorizer = authorizer

server = FTPServer(("127.0.0.1", 1026), handler)
server.serve_forever()

replace username with your’s

keep in mind that the port number should be greater than 1024 or it will throw an error “socket.error: [Errno 13] Permission denied” because you can’t bind to a port lower than 1024 as you don’t have that right.

for client we are using ftplib module from the official python library

ftp-client.py:

from ftplib import FTP

ftp = FTP('')
ftp.connect('localhost',1026)
ftp.login()
ftp.cwd('directory_name') #replace with your directory
ftp.retrlines('LIST')

def uploadFile():
 filename = 'testfile.txt' #replace with your file in your home folder
 ftp.storbinary('STOR '+filename, open(filename, 'rb'))
 ftp.quit()

def downloadFile():
 filename = 'testfile.txt' #replace with your file in the directory ('directory_name')
 localfile = open(filename, 'wb')
 ftp.retrbinary('RETR ' + filename, localfile.write, 1024)
 ftp.quit()
 localfile.close()

uploadFile()
#downloadFile()

Note that the port number and ip should be same as the server’s.

Now, run the server script first and then the client script

python ftp-server.py
python ftp-client.py

Homework Ocean
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents