@@ -353,7 +353,7 @@ This is the server side::
353353 print("{} wrote:".format(self.client_address[0]))
354354 print(self.data)
355355 # just send back the same data, but upper-cased
356- self.request.send (self.data.upper())
356+ self.request.sendall (self.data.upper())
357357
358358 if __name__ == "__main__":
359359 HOST, PORT = "localhost", 9999
@@ -383,7 +383,7 @@ objects that simplify communication by providing the standard file interface)::
383383The difference is that the ``readline() `` call in the second handler will call
384384``recv() `` multiple times until it encounters a newline character, while the
385385single ``recv() `` call in the first handler will just return what has been sent
386- from the client in one ``send () `` call.
386+ from the client in one ``sendall () `` call.
387387
388388
389389This is the client side::
@@ -400,7 +400,7 @@ This is the client side::
400400 try:
401401 # Connect to server and send data
402402 sock.connect((HOST, PORT))
403- sock.send (bytes(data + "\n", "utf-8"))
403+ sock.sendall (bytes(data + "\n", "utf-8"))
404404
405405 # Receive data from the server and shut down
406406 received = str(sock.recv(1024), "utf-8")
@@ -498,7 +498,7 @@ An example for the :class:`ThreadingMixIn` class::
498498 data = str(self.request.recv(1024), 'ascii')
499499 cur_thread = threading.current_thread()
500500 response = bytes("{}: {}".format(cur_thread.name, data), 'ascii')
501- self.request.send (response)
501+ self.request.sendall (response)
502502
503503 class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
504504 pass
@@ -507,7 +507,7 @@ An example for the :class:`ThreadingMixIn` class::
507507 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
508508 sock.connect((ip, port))
509509 try:
510- sock.send (bytes(message, 'ascii'))
510+ sock.sendall (bytes(message, 'ascii'))
511511 response = str(sock.recv(1024), 'ascii')
512512 print("Received: {}".format(response))
513513 finally:
0 commit comments