title: python socket recv() and signals
body: <p>i have a simple (non-threaded) script that listens on a socket for data, analyses it and uses internally <code>SIGALRM</code>'s to send emails at predefined timer internals.</p>
  
  <p>the problem is during the <code>recv()</code> loop, the occurrence of the <code>SIGALRM</code> appears to raise a </p>
  
  <pre><code>socket.error: [Errno 4] Interrupted system call
  </code></pre>
  
  <p>and hence terminating the program.</p>
  
  <p>i can wrap the <code>recv()</code> with a try/except block, but i was wondering whether i would loose any data during this time, or whether the buffer will prevent loss.</p>
  
  <pre><code>s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  s.bind((host, port))
  while True:
      try:
          data = s.recv(2048)
      except socket.error, e:
          pass
      yield data
  s.close()
  return
  </code></pre>