Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remote File Transfer- Error
#2
#Client Code:
elif command.lower() == "upload":
        file_name = s.recv(1024).decode()
        data2 = s.recv(1078000)
        new_file = open(file_name, "wb")
        while(data2):         
            new_file.write(data2)
            data2 = s.recv(1078000)
            new_file.close()
            print("Recieved File")
#Server code:
 elif command.lower() == "upload":
        client_socket.send(command.encode())
        print("")
        file_path = input(str("Enter the file path to send: "))
        file_name = input(str("Enter the file NAME to send: "))
        client_socket.send(file_name.encode())       
        f = open(file_path, "rb")
        print('Sending file...')
        data = f.read(1078000)
        while(data):
                connectionSocket.send(data)
                data = f.read(1078000)
                f.close()
                print('Done sending')
Reply


Messages In This Thread
Remote File Transfer- Error - by wonderboy - Jan-06-2021, 10:46 AM
RE: Remote File Transfer- Error - by wonderboy - Jan-06-2021, 11:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connecting to Remote Server to read contents of a file ChaitanyaSharma 1 357 May-03-2024, 07:23 AM
Last Post: Pedroski55
  file transfer via python SFTP SCP mg24 3 3,182 Sep-15-2022, 04:20 AM
Last Post: mg24
  Multithreaded file transfer from multiple volumes skoobi 2 1,233 Jul-28-2022, 07:52 AM
Last Post: skoobi
Question resume file transfer onran 0 1,740 Jan-27-2021, 02:16 PM
Last Post: onran
  code to read files in folders and transfer the file name, type, date created to excel Divya577 0 1,928 Dec-06-2020, 04:14 PM
Last Post: Divya577
  DNP3 file transfer with python Aussie 0 1,506 Sep-01-2020, 10:45 PM
Last Post: Aussie
  Splitting the audio file into smaller packets before transfer using UDP protocol in p MuhammadAli152 0 3,805 May-15-2020, 03:01 PM
Last Post: MuhammadAli152
  How to stop Xmodem after bin file transfer was finished shaya2103 0 2,590 Nov-27-2019, 04:33 PM
Last Post: shaya2103
  Read a remote text file Sandy7771989 1 7,124 Jul-18-2019, 06:55 PM
Last Post: ndc85430
  How to run python code in Java using remote SSH without py file using streams in Java varanasipavankumar 0 2,585 Apr-07-2019, 06:13 PM
Last Post: varanasipavankumar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020