citadel/poky/meta/lib/oeqa/utils/network.py

9 lines
174 B
Python
Raw Normal View History

import socket
def get_free_port():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 0))
addr = s.getsockname()
s.close()
return addr[1]