[docs] found an error in documentation

Ing. Felipe Martinez fmartinez at syscom.com.mx
Wed Nov 23 20:25:44 CET 2011

in SocketServer.UDPServer Example¶ 

on the line 13 have a error :

This is the server side:

1 import SocketServer

2 class MyUDPHandler(SocketServer.BaseRequestHandler):
3    """
4   This class works similar to the TCP handler class, except that
5   self.request consists of a pair of data and client socket, and since
6   there is no connection the client address must be given explicitly
7   when sending data back via sendto().
8   """

9   def handle(self):
10       data = self.request[0].strip()
11       socket = self.request[1]
13       print "{} wrote:".format(self.client_address[0])    # on this 
line have the error, you concatenate whit . and need to be whit +
         print data
         socket.sendto(data.upper(), self.client_address)

if __name__ == "__main__":
     HOST, PORT = "localhost", 9999
     server = SocketServer.UDPServer((HOST, PORT), MyUDPHandler)

i speak a litle english, have a nice day.

Ing. Felipe Martinez
Tel: (614) 415-2525 ext 1358
Email: fmartinez at syscom.com.mx

More information about the docs mailing list