readwrite client socket if not databreak reply 'echo=>% at % (datanow()self request send(reply encode()self request close(make threaded serverlisten/handle clients forever myaddr (myhostmyportserver socketserver threadingtcpserver(myaddrmyclienthandlerserver serve_forever(this server works the same as the threading server we wrote by hand in the previous sectionbut instead focuses on service implementation (the customized handle method)not on threading details it is run the same waytoo--here it is processing three clients started by handplus eight spawned by the testecho script shown we wrote in example - [window serverserverhost='localhostin echo-client pyc:\pp \internet\socketspython class-server py ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : ( ' sun apr : : [windows - clientsame machinec:\pp \internet\socketspython echo-client py client receivedb"echo=> 'hello network worldat sun apr : : :\pp \internet\socketspython echo-client py localhost arthur client receivedb"echo=> 'arthurat sun apr : : :\pp \internet\socketspython echo-client py localhost brave sir robin client receivedb"echo=> 'braveat sun apr : : client receivedb"echo=> 'sirat sun apr : : client receivedb"echo=> 'robinat sun apr : : :\pp \internet\socketspython testecho py to build forking server insteadjust use the class name forkingtcpserver when creating the server object the socketserver module has more power than shown by this exampleit also supports nonparallel ( serial or synchronousserversudp and unix domain socketsand ctrl- server interrupts on windows see python' library manual for more details for more advanced server needspython also comes with standard library tools that use those shown hereand allow you to implement in just few lines of python code handling multiple clients