Skip to content

Instantly share code, notes, and snippets.

@giefko
giefko / FileTransferTCPClient
Last active October 23, 2022 22:40
Python File Transfer over TCP
import socket # Import socket module
s = socket.socket() # Create a socket object
host = "1somehing.11somehing." #Ip address that the TCPServer is there
port = 50000 # Reserve a port for your service every new transfer wants a new port or you must wait.
s.connect((host, port))
s.send("Hello server!")
with open('received_file', 'wb') as f: