Tzury Bar Yochay <[EMAIL PROTECTED]> writes: > The following is a code I am using for a simple tcp echo server. > When I run it and then connect to it (with Telnet for example) if I > shout down the telnet the CPU tops 100% of usage and saty there > forever. Can one tell what am I doing wrong?
If you shut down telnet, self.request.recv(1024) returns an empty string, meaning EOF, and you start inflooping. > def handle(self): > while 1: > data = self.request.recv(1024) > self.request.send(data) > if data.strip() == 'bye': # add: or data == '' > return -- http://mail.python.org/mailman/listinfo/python-list