#!/usr/bin/python
import socket
webhost = 'localhost'
webport = 8080
print("Nawiązywanie połączenia z adresem %s i portem %d..." % (webhost, webport))
webclient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
webclient.connect((webhost, webport))
webclient.send(bytes("GET / HTTP/1.1\r\nHost: localhost\r\n\r\n".encode('utf-8')))
reply = webclient.recv(4096)
print("Odpowiedź z adresu %s: " % webhost)
print(reply.decode())