I wonder if somebody more versed with socket programming than could
explain the following behaviour.
I have the following piece of code in my program:
inps, outs, exps = select([conn],[],[], 3.0)
count = 1
while not inps:
# Do other things while waiting for data...
count = count + 1
print 'select reports not ready'
if count > 10:
count = 0
print 'breaking out'
break
inps, outs, exps = select([conn],[],[], 3.0)
message = conn.recv(size)
After a while the select always returns with the inps set to [],
and the loop breaks out:
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
select reports not ready
breaking out
However, the message is always correctly read at the line
message = conn.recv(size)
The remote end sends a message to the socket once a second, so I
thought the select should always return 'conn' ready.
In other parts of the program I do read the same socket without
select, not caring if it blocks there. This may be something very
stupid I'm doing on my part.
This is for Python 1.1.1, Sparc-Solaris 2.3.
Any ideas?
Harri
-- ========================================================================== "All of these trivial amounts of code are adding up fast, though.""Please don't ask when version 2 will be released; we generally don't know the answer to questions of that sort." Richard M. Stallman