Question

In: Computer Science

Answer as soon as possible!!! Code must be done with Python Develop a basic File Transfer...

Answer as soon as possible!!!

Code must be done with Python

Develop a basic File Transfer Protocol (FTP) application that transmits files between a client and a server using Python. Your programs should implement four FTP commands: (1) change directory (cd), (2) list directory content (ls), (3) copy a file from client to a server (put) and (4) copy a file from a server to a client (get). Implement two versions of the program: one that uses stock TCP for reliable data transfer; and one that implements stop-and-wait reliability at the application layer and uses UDP for transport.

So therefore it has to have client-server TCP implementation and UPD implementation.

Solutions

Expert Solution

FTP programming python using ftplib library, are connect to FTp servers,or download and upload files.

FTP is network protocol it use for transfering files with client and server on a computer network,it has DELE,RETR or CWD communication with FTP commands.

1) Change Directory :- The use purpose for change directory cwd() method the current working directory.

for example:-

FTP with ftplib, as cover both uploading and downloading files with a remote server.


// Set has domain name or server ip address//
ftp = FTP ('server.ip')
ftp.login(user= 'username', pass = 'password')
// Will connect you to your remote server. You can then change into a specific directory.

ftp.cwd('/abc/')

2) List Directory Content:- It has retrieve a file or directory listing in transfer mode of LIST retrieves a list of files and information about those files.

It use for retrlines command.

for examples:-

ftps.retrlines('LIST') // Set  list directory content securely.

3,4) Copy a file from client to a server:- FTP is the process of copying or moving a file for computer to anathor network or Internet connection.

It's create a server that listens on a particular port, and server will be responce for file receiving, the client will try to connect to the server and send a file of any type.

Its socket module going to use build-in with python and with socket operations, it use for internet are behind of any connection or any network.

for examples:-

// Set import socket

import socket

BUFFER_SIZE = 5016 // Set 5016 byte

// It specify the IP address or port of the server to connect name file we want to send.

host = "192.168.1.110"

port = 5001

filename = "abcData.csv"

filesize = os.path.getsize

Filename it use to current directory,and use for absolute path to that file somewhere in your computer.

The os.path.getsize get the size of file in byte.


Related Solutions

(I need answer as soon as possible). Que. Explain three basic financial statements in details and...
(I need answer as soon as possible). Que. Explain three basic financial statements in details and show how they reflect the activity and financial condition of a business?
Second Time Posting - Do not Rush to answer question - Must be done in Python...
Second Time Posting - Do not Rush to answer question - Must be done in Python - Please HELP Write and Compile a python script to solve the 4-queens problem using the Iterative Improvement Algorithm. The code should allow for random starting, and for placed starting. Random Starting means randomly place a queen position on the chessboard. Placed Starting means asked for the user input to place a queen position on the chessboard. Display the iterations until the final solution...
USE BASIC PYTHON Focus on Basic file operations, exception handling. Save a copy of the file...
USE BASIC PYTHON Focus on Basic file operations, exception handling. Save a copy of the file module6data.txt (Below) Write a program that will a. Open the file module6data.txt b. Create a second file named processed. txt c. Read the numbers from the first file one at a time. For each number write into second file, if possible, its I. Square ii. Square root iii. Reciprocal (1/number)use a math module function for the square root. use exception handling to trap possible...
this is a python code that i need to covert to C++ code...is this possible? if...
this is a python code that i need to covert to C++ code...is this possible? if so, can you please convert this pythin code to C++? def main(): endProgram = 'no' print while endProgram == 'no': print # declare variables notGreenCost = [0] * 12 goneGreenCost = [0] * 12 savings = [0] * 12 months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] getNotGreen(notGreenCost, months) getGoneGreen(goneGreenCost, months) energySaved(notGreenCost, goneGreenCost, savings) displayInfo(notGreenCost, goneGreenCost, savings, months)...
in python please ,, A SOON AS POSSIBLE PLEASE #Class invariant for SimpleQueue, a queue based...
in python please ,, A SOON AS POSSIBLE PLEASE #Class invariant for SimpleQueue, a queue based on a linked list # 1. The queue is a linked list of ListNode objects. # 2. A SimpleQueue object has instance variables self.head, a reference to the node at the front of the queue, self.tail, a reference # to the node at the end of the queue, and self.size, the number of nodes in the queue. # 3. If self.size = 0, then...
Language: Python 3 (Please structure answer as basic as possible) Write a function that involves two...
Language: Python 3 (Please structure answer as basic as possible) Write a function that involves two arguments, named changeTheCase(myFile, case), that takes, as arguments, the name of a file, myFile, and the case, which will either be “upper” or “lower”. If case is equal to “upper” the function will open the file, convert all characters on each line to upper case, write each line to a new file, named “upperCase.txt”, and return the string “Converted file to upper case.” If...
Python 3 Fix the code. It is not saving the data into the xls file Code:...
Python 3 Fix the code. It is not saving the data into the xls file Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20) tk.Label(window, text="Working product").grid(row=4, sticky="W", pady=20, padx=20) #Working product label tk.Label(window, text="Failed...
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file...
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file must satisfy the following. Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less...
Please try to answer as soon as possible. Thanks in advance. Answer the questions true, false...
Please try to answer as soon as possible. Thanks in advance. Answer the questions true, false or uncertain and provide a brief explanation or a graph to defend your answer. 1 a) A change in relative prices will always change a utility maximizing consumer’s marginal rate of substitution. 1b) Competitive firms shutdown production when price falls below the minimum of the average total cost curve. 1c) An increase the price of firms output will always increase the use of an...
PLEASE ANSWER #8, 9 AND 10 AS SOON AS POSSIBLE. THANK YOU IF POSSIBLE PLEASE DO...
PLEASE ANSWER #8, 9 AND 10 AS SOON AS POSSIBLE. THANK YOU IF POSSIBLE PLEASE DO WHOLE QUESTIONS. I WANT TO DOUBLE CHECK WITH MINE Required:#1.Prepare journal entries to record the December transactions in the General Journal Tab in the excel template file "Accounting Cycle Excel Template.xlsx". Use the following accounts as appropriate: Cash, Accounts Receivable, Supplies, Prepaid Insurance, Equipment, Accumulated Depreciation, Accounts Payable, Wages Payable, Common Stock, Retained Earnings, Dividends, Service Revenue, Depreciation Expense, Wages Expense, Supplies Expense, Rent...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT