Chatroom Source

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('0.0.0.0',25565))
s.listen(10)

while True:
    print('waiting for new connection')
    conn,addr = s.accept()
    print('New connection: ' + str(addr))

    motd = "Welcome to PolyChat!"
    conn.sendto(bytes(motd,'utf-8'), addr)

    char = ''
    message = ''
    while char != None and char != 'q':
        char,temp = conn.recvfrom(1024)
        char = char.decode('utf-8')
        message += char
        print(message)
        
    conn.close()