summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/network.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/network.py')
-rw-r--r--meta/lib/oeqa/utils/network.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/network.py b/meta/lib/oeqa/utils/network.py
new file mode 100644
index 0000000000..2768f6c5db
--- /dev/null
+++ b/meta/lib/oeqa/utils/network.py
@@ -0,0 +1,8 @@
1import socket
2
3def get_free_port():
4 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
5 s.bind(('', 0))
6 addr = s.getsockname()
7 s.close()
8 return addr[1]