[PyKDE] QSocket.readBlock/QSocket.getch() difference
Michael Ferraro
michael at possibleworlds.com
Mon Dec 3 23:08:44 GMT 2001
hello
in response to a readyRead() signal i check if a socket.bytesAvailable()
is non-zero at which point I do a socket.readBlock(maxbytes). The
buffer returned is zero bytes long and doesn't have any data in it.
As a test I followed the readBlock with a loop that makes calls to
socket.getch() which returns valid data for the number of
bytesAvailable.
I can use getch()s if I have to, but it seems that readBlock should work
in here. What might I be doing wrong this time, I ask.
def HandShake (self):
socket = self.sender()
n = socket.bytesAvailable()
if n > 0:
hail = socket.readBlock(32)
print "readBlock(): ", len(hail), hail # -- hail is empty
for i in range (n):
print "getch(): ", socket.getch () # -- prints
valid data
thanks for any help
Michael
More information about the PyQt
mailing list