web server - accept() method
crescent_au at yahoo.com
Fri Nov 7 10:43:59 CET 2003
Just trying to figure out what the accept() method in socket.py does.
Lets consider the following webserver code:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 8881
(newSock, addr) = sock.accept()
Here accept() returns newSock and addr. In my case "addr" holds the
value something like: ('127.0.0.1', 2571). What is 2571? This value
keeps changing each time i make a connection to above webserver. What
does this mean?
And also what is "newSock"? It holds value such as:
<socket object, fd=4, family=2, type=1, protocol=0>
What do i mean by this?
More information about the Python-list