title: how to do non blocking accept() in Python?
body: <p>I cannot use threads thus I want to write a server program that can be interrupted after a while:</p>
  
  <pre>
  d = show_non_modal_dialog("serving clients")
  s = socket(...)
  s.bind(...)
  s.listen()
  while (!user_pressed_cancel())
  {
    s.accept() # timed accept for like 1 second
    if timed_out:
      continue
    serve_client
    close_client_sock
  }
  hide_non_modal_dialog(d)
  </pre>