sock.setblocking(0)
try:
data = sock.recv(1024)
except socket.error, e:
if e.args[0] == errno.EWOULDBLOCK:
print 'EWOULDBLOCK'
else:
if not data: #recv over
sock.close()
print 'close================='
else:
print 'recv ---data---------'
poem += data
all above code is in a loop.using non-blocking socket(just want to test 'non-blocking socket') to get data. But always print 'EWOULDBLOCK',i don't know why?