one comment in the example for clarity.
\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()
\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)