mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
merge with 3.3
This commit is contained in:
commit
1e6a3a2fe9
1 changed files with 5 additions and 3 deletions
|
|
@ -84,9 +84,11 @@ creates a "server socket"::
|
||||||
serversocket.listen(5)
|
serversocket.listen(5)
|
||||||
|
|
||||||
A couple things to notice: we used ``socket.gethostname()`` so that the socket
|
A couple things to notice: we used ``socket.gethostname()`` so that the socket
|
||||||
would be visible to the outside world. If we had used ``s.bind(('', 80))`` or
|
would be visible to the outside world. If we had used ``s.bind(('localhost',
|
||||||
``s.bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would still
|
80))`` or ``s.bind(('127.0.0.1', 80))`` we would still have a "server" socket,
|
||||||
have a "server" socket, but one that was only visible within the same machine.
|
but one that was only visible within the same machine. ``s.bind(('', 80))``
|
||||||
|
specifies that the socket is reachable by any address the machine happens to
|
||||||
|
have.
|
||||||
|
|
||||||
A second thing to note: low number ports are usually reserved for "well known"
|
A second thing to note: low number ports are usually reserved for "well known"
|
||||||
services (HTTP, SNMP etc). If you're playing around, use a nice high number (4
|
services (HTTP, SNMP etc). If you're playing around, use a nice high number (4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue