1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-22 15:10:12 +01:00

Merge pull request #11 from kelvl/macos-cant-assign-address-fix

Fix for [Errno 49] Can't assign requested address
This commit is contained in:
Matthew Garrett 2016-11-04 16:33:02 -06:00 committed by GitHub
commit 0b9dd40921

View File

@ -8,7 +8,7 @@ import socket
def discover(timeout=None):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 0)) # connecting to a UDP address doesn't send packets
s.connect(('8.8.8.8', 53)) # connecting to a UDP address doesn't send packets
local_ip_address = s.getsockname()[0]
address = local_ip_address.split('.')
cs = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)