Oddity question
Mariano Corsunsky
core.lists.python at core-sdi.com
Tue Feb 26 12:31:45 EST 2002
Hi there!
I was fooling around with sockets last night, using a thread to deal with the read part and another method to do the print.
like this:
def thread_read (self):
while 1:
self.buf=self.buf+self.my_socket.recv (8)
def print_buf(self):
if buf:
print "bufeer-->",buf
buf='""
But, what happened to me was that the -buf = ""- line seemed to be not working because I got outputs like this
buffer->a
buffer->ab
buffer->abpleasework
buffer->abpleaseworkpleaseflush!
So, I dont know why I changed thread_read function to:
while 1:
aux=self.my_socket.recv (8)
self.buf=self.buf+aux
And this version worked properly..... but I still do not know why. To me, I've only split the line in two, using an auiliar variable... but THAT made the trick!
why?
WHY?
W H Y?
(thanks for answers)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020226/a622d95a/attachment.html>
More information about the Python-list
mailing list