title: Python, wait until network interface is up?
body: <p>I have a python script which opens a port and listens to it on Raspberry. I added it to <code>/etc/rc.local</code> 
  and everything is working properly. But my problem is the socket which is not created when the process is being executed. </p>
  
  <pre><code>s = socket.socket()      
  s.bind((host_ip,port)) #e.g. host_ip='192.168.1.32' , port=12345
  s.listen(5)
  while True:
      c,addr = s.accept()
      c.send('ACK')
      c.close()
  </code></pre>
  
  <p>the above code is not executed because there is no 'eth0' connection available. What should I do? Should I loop scan the socket status until connection is being available? Is there any other more sophisticated solution?</p>