From: Francisco Pedraza Date: Fri, 19 Feb 2016 22:05:41 +0000 (-0600) Subject: oeqa/utils: added new network module X-Git-Tag: 2016-4~733 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=72b336ad0d0a2994f00c57747686111a59fa8b29;p=openembedded-core.git 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 --- 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]