import socket

mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mySocket.bind(('localhost', 8080))

mySocket.listen(5)

while True:
    print('Oczekiwanie na połączenia...')
    (recvSocket, address) = mySocket.accept()
    print('Odebranie zapytanie HTTP:')
    print(recvSocket.recv(1024))
    recvSocket.send(bytes("HTTP/1.1 200 OK\r\n\r\n<html><body><h1>Witaj, świecie!</h1></body></html> \r\n", 'utf-8'))
    recvSocket.close()
