]> granicus.if.org Git - python/commitdiff
Use bytes in myreceive.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 29 May 2011 15:15:44 +0000 (17:15 +0200)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 29 May 2011 15:15:44 +0000 (17:15 +0200)
Doc/howto/sockets.rst

index 80e98f7b7ea19b939b9b2b06dfbcfdd0d17aaf64..241680798b7552e91270d50bc99b33826d37ffaa 100644 (file)
@@ -208,10 +208,10 @@ length message::
                totalsent = totalsent + sent
 
        def myreceive(self):
-           msg = ''
+           msg = b''
            while len(msg) < MSGLEN:
                chunk = self.sock.recv(MSGLEN-len(msg))
-               if chunk == '':
+               if chunk == b'':
                    raise RuntimeError("socket connection broken")
                msg = msg + chunk
            return msg