mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 05:29:32 +00:00
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:
committed by
Richard Purdie
parent
3f7aa6fc5d
commit
00a6f5afeb
@@ -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]
|
||||||
Reference in New Issue
Block a user