python - How to send and receive whole text message (not just a part) using socket -


i'm trying create simple (line) server using socketserver. i'm totally new in , problem is, don't know how handle recv function. don't want send files or that. written text client , response server bigger (output of ipconfig etc.)

could give me advice how make work?

when want request server longer, example ipconfig /all, returns fraction of desired output client , waits. if new request client, returns rest of output previous request.

here server:

class threadedtcpserver(socketserver.threadingmixin, socketserver.tcpserver):     daemon_threads = true   class threadedtcprequesthandler(socketserver.baserequesthandler):     def handle(self):         while 1:             data = self.request.recv(1024)             output = process_command(data)              response = "{}".format(output)             self.request.sendall(response)   if __name__ == "__main__":      host, port = _host, int(_port)      server = threadedtcpserver((host, port), threadedtcprequesthandler)      print "running on: %s:%s" % (host, port)     server.serve_forever() 

in line:

data = self.request.recv(1024) 

the 1024 limiter number of bits data string can contain, 1024 bits == 128 bytes == 128 character string. increase number 4096 , increase limit 512.


Comments