[OE-core] [PATCHv2 1/2] oeqa/utils: added new networke module
Francisco Pedraza
francisco.j.pedraza.gonzalez at intel.com
Mon Feb 15 19:10:41 UTC 2016
A network module was added, and will contain network utility funcions for now.
with get_free_port that returns availabe network port in the system.
Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez at intel.com>
---
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 0000000..2768f6c
--- /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]
--
2.5.0
More information about the Openembedded-core
mailing list