@@ -365,7 +365,7 @@ This is the server side::
365365 print("{} wrote:".format(self.client_address[0]))
366366 print(self.data)
367367 # just send back the same data, but upper-cased
368- self.request.send (self.data.upper())
368+ self.request.sendall (self.data.upper())
369369
370370 if __name__ == "__main__":
371371 HOST, PORT = "localhost", 9999
@@ -395,7 +395,7 @@ objects that simplify communication by providing the standard file interface)::
395395The difference is that the ``readline() `` call in the second handler will call
396396``recv() `` multiple times until it encounters a newline character, while the
397397single ``recv() `` call in the first handler will just return what has been sent
398- from the client in one ``send () `` call.
398+ from the client in one ``sendall () `` call.
399399
400400
401401This is the client side::
@@ -412,7 +412,7 @@ This is the client side::
412412 try:
413413 # Connect to server and send data
414414 sock.connect((HOST, PORT))
415- sock.send (bytes(data + "\n", "utf-8"))
415+ sock.sendall (bytes(data + "\n", "utf-8"))
416416
417417 # Receive data from the server and shut down
418418 received = str(sock.recv(1024), "utf-8")
@@ -510,7 +510,7 @@ An example for the :class:`ThreadingMixIn` class::
510510 data = str(self.request.recv(1024), 'ascii')
511511 cur_thread = threading.current_thread()
512512 response = bytes("{}: {}".format(cur_thread.name, data), 'ascii')
513- self.request.send (response)
513+ self.request.sendall (response)
514514
515515 class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
516516 pass
@@ -519,7 +519,7 @@ An example for the :class:`ThreadingMixIn` class::
519519 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
520520 sock.connect((ip, port))
521521 try:
522- sock.send (bytes(message, 'ascii'))
522+ sock.sendall (bytes(message, 'ascii'))
523523 response = str(sock.recv(1024), 'ascii')
524524 print("Received: {}".format(response))
525525 finally:
0 commit comments