Skip to content

Commit

Permalink
Merge pull request #3436 from ARMmbed/net_echo_test_host_fix
Browse files Browse the repository at this point in the history
Fix network echo test host scripts for Mac
  • Loading branch information
sg- authored Dec 15, 2016
2 parents 6b64dbc + b77f663 commit 899c542
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def find_interface_to_target_addr(target_ip):
: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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def find_interface_to_target_addr(target_ip):
: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
Expand Down

0 comments on commit 899c542

Please sign in to comment.