<filename>server.py
import socket
import struct

HOST = '127.0.0.1'
PORT = 65432

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as socket_connection:
    socket_connection.bind((HOST, PORT))
    socket_connection.listen()
    conn, addr = socket_connection.accept()
    with conn:
        print(f'Connected by {addr}')
        while True:
            try:
                t = int(input('Value (int): '))
                assert t >= 0
                d = struct.pack('I', t)
                conn.sendall(d)
            except KeyboardInterrupt:
                break
