A Persistent Uppercase Server Using TCP : TCP : Network PYTHON examples


PYTHON examples » Network » TCP »

 

A Persistent Uppercase Server Using TCP


 

import SocketServer
import netstring

class MyRequestHandler(SocketServer.BaseRequestHandler):
    def handle(self):
       print "From:", self.client_address
       while 1:
           rq = netstring.readns(self.request)
           print rq
           netstring.writens(self.request, rq.upper())
           if rq.lower() == "end":
               break

myServer = SocketServer.TCPServer(('', 8081),
                MyRequestHandler)
myServer.handle_request()

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Network
» TCP