Untitled
unknown
plain_text
a year ago
491 B
7
Indexable
import socket
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.connect(('localhost', 54321))
fileReceived = "ReceivedFile.txt"
print("Looking for file on localhost:54321!")
with open(fileReceived, 'wb') as fileObject:
print('Receiving the file..')
while True:
fileContents = clientSocket.recv(1024)
if not fileContents:
break
fileObject.write(fileContents)
clientSocket.close()
print('Connection has been closed!')
Editor is loading...
Leave a Comment