#!/usr/bin/python3.1import socketserverclass MyTCPHandler(socketserver.StreamRequestHandler): """ The request handler class for our server It's instantiated once per connection to the server and must override the handle() method to implement communications to the client. """ def handle(self): # self.rfile is a file-like object created by the handler ; # we can now use e.g. readline() instead of raw recv() calls self.data = self.rfile.readline()# self.data = self.data[4:] self.splitted_data = self.data.split("/", 1) print("%s wrote:" % self.client_address[0]) print(self.data) # Likewise, self.wfile is a file-like object used to write back # to the client self.wfile.write(self.splitted_data)if __name__ == "__main__": HOST, PORT = "localhost", 8003 # create the server, binding to localhost on port 8000 server = socketserver.TCPServer((HOST, PORT), MyTCPHandler) # activate the server ; this will keep running until you interrupt # the program wich CTRL-C server.serve_forever()