Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libsocket.tex @ 15146:5cf0a02a574b legacy-trunk
Revise the examples not to use the "from socket import *", and adjust
one comment in the example for clarity.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 10 Oct 2000 20:36:29 +0000 |
| parents | e348ed946d1f |
| children | 3a260274bcc6 |
line wrap: on
line diff
--- a/Doc/lib/libsocket.tex Tue Oct 10 20:23:10 2000 +0000 +++ b/Doc/lib/libsocket.tex Tue Oct 10 20:36:29 2000 +0000 @@ -426,10 +426,11 @@ \begin{verbatim} # Echo server program -from socket import * +import socket + HOST = '' # Symbolic name meaning the local host -PORT = 50007 # Arbitrary non-privileged server -s = socket(AF_INET, SOCK_STREAM) +PORT = 50007 # Arbitrary non-privileged port +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() @@ -443,10 +444,11 @@ \begin{verbatim} # Echo client program -from socket import * +import socket + HOST = 'daring.cwi.nl' # The remote host PORT = 50007 # The same port as used by the server -s = socket(AF_INET, SOCK_STREAM) +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.send('Hello, world') data = s.recv(1024)
