From 72b336ad0d0a2994f00c57747686111a59fa8b29 Mon Sep 17 00:00:00 2001 From: Francisco Pedraza Date: Fri, 19 Feb 2016 16:05:41 -0600 Subject: oeqa/utils: added new network module A network module was added, and will contain network utility funcions for now. with get_free_port that returns available network port in the system. Signed-off-by: Francisco Pedraza Signed-off-by: Ross Burton --- meta/lib/oeqa/utils/network.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 meta/lib/oeqa/utils/network.py 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 @@ +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] -- cgit v1.2.3