I have a normal vanilla socket that can send and receive data. The issue arises when there is a high latency and it takes a while to get the data. For example I'll have:
s.recv(1024)
But by the time it executes, only 700 bytes will be available. So I have to do it again to get the rest. But here's the kicker: sometimes it will be faster and the second s.recv(1024)
will be waiting for data when none is coming. In that case it gets stuck in a long, long loop that I can't even interrupt using Ctrl+C. The question is, how can I prevent this loop? Is there a way to raise an Exception if no data is available?