from socket import *
from struct import *
from threading import *
s = socket(AF_INET, SOCK_STREAM)
s.bind(('', 8888))
s.listen(100)


def proc(cs):
    msglen = unpack("!i", cs.recv(4))[0]
    msg = cs.recv(msglen)
    cs.sendall(msg.decode().upper().encode())


while True:
    (cs, addr) = s.accept()
    # Thread(None, proc, args=(cs, )).start()
    proc(cs)
