Skip to content

Commit

Permalink
Merge pull request #30 from philippeportesppo/service_manager_upnp
Browse files Browse the repository at this point in the history
Service manager upnp
  • Loading branch information
philippeportesppo authored Feb 13, 2018
2 parents 128aab5 + 44e058c commit c33271f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ssdp_upnp/ssdp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@



NETWORK_INTERFACE = 'wlan0' # or 'eth0'
NETWORK_INTERFACE = 'wlan0'



Expand Down Expand Up @@ -76,25 +76,28 @@ def get_network_interface_ip_address(interface='wlan0'):
"""

while True:

if NETWORK_INTERFACE not in ni.interfaces():
while interface not in ni.interfaces():

print('Could not find interface %s.' % (interface,))

print('Could not find interface %s.' % (interface,))
sleep(10)

exit(1)

interface = ni.ifaddresses(interface)

if (2 not in interface) or (len(interface[2]) == 0):
while True:
interfacestring = ni.ifaddresses(interface)

if (2 not in interfacestring) or (len(interfacestring[2]) == 0):

print('Could not find IP of interface %s. Sleeping.' % (interface,))

sleep(60)
sleep(10)

continue

return interface[2][0]['addr']
else:
break
return interfacestring[2][0]['addr']


print "Start..."
Expand Down

0 comments on commit c33271f

Please sign in to comment.