import socket s = socket.socket() host = socket.gethostname() port = 1234 s.bind((host, port)) s.listen(5) while True: c, addr = s.accept() print 'Got connection from', addr c.send('Thank you for connecting') c.close()
import socket s = socket.socket() host = socket.gethostname() port = 1234 s.connect((hos
These are the two examples given to me from the python book I'M currently reading in the network chapter. The problem is, I still have know idea how this would work. I don't image having the minimal server .py file floating around somewhere on a server would make it work. I have no idea how servers work but I'M expected to understand this from a book that teaches python. Please help, thanks.