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.

(From OE-Core rev: 72b336ad0d0a2994f00c57747686111a59fa8b29)

Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Francisco Pedraza 2016-02-19 16:05:41 -06:00 committed by Richard Purdie
parent 3f7aa6fc5d
commit 00a6f5afeb
1 changed files with 8 additions and 0 deletions

View File

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