Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCHv2 1/2] oeqa/utils: added new networke module
@ 2016-02-15 19:10 Francisco Pedraza
  2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza
  2016-02-15 19:48 ` [PATCHv2 1/2] oeqa/utils: added new networke module Benjamin Esquivel
  0 siblings, 2 replies; 4+ messages in thread
From: Francisco Pedraza @ 2016-02-15 19:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: Francisco Pedraza

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@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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-15 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 19:10 [PATCHv2 1/2] oeqa/utils: added new networke module Francisco Pedraza
2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza
2016-02-15 19:48   ` Benjamin Esquivel
2016-02-15 19:48 ` [PATCHv2 1/2] oeqa/utils: added new networke module Benjamin Esquivel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox