title: Is there a way to know how much data is available in a Python socket to receive?
body: <p>I have figured out that I must use ioctl. There are similar questions here:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/6898249/how-to-tell-how-much-data-is-in-a-sockets-send-buffer">How to tell how much data is in a Socket&#39;s send buffer</a></li>
  <li><a href="https://stackoverflow.com/questions/3926341/determing-the-number-of-bytes-ready-to-be-recvd">Determing the number of bytes ready to be recv()&#39;d</a></li>
  </ul>
  
  <p>My questions are:</p>
  
  <ol>
  <li>What is an equivalent to FIONREAD in Python? How do I call sock.ioctl() to obtain the amount of bytes available?</li>
  <li>What if I am using Python 2.5 on Windows? socket.ioctl is new in version 2.6.</li>
  </ol>