Merge pull request #3612 from bulislaw/fix_network_host_tool

tests: Fix error on MacOS for udp_dtls_handshake test
pull/3649/head
Martin Kojtal 2017-01-26 10:33:32 +02:00 committed by GitHub
commit 4e28b25399
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ class UDPEchoClientTest(BaseHostTest):
:return:
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((target_ip, 0)) # Target IP, Any port
try:
s.connect((target_ip, 0)) # Target IP, any port
except socket.error:
s.connect((target_ip, 8000)) # Target IP, 'random' port
ip = s.getsockname()[0]
s.close()
return ip