diff options
Diffstat (limited to 'meta/lib/oeqa/utils/network.py')
| -rw-r--r-- | meta/lib/oeqa/utils/network.py | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ | |||
| 1 | import socket | ||
| 2 | |||
| 3 | def get_free_port(): | ||
| 4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
| 5 | s.bind(('', 0)) | ||
| 6 | addr = s.getsockname() | ||
| 7 | s.close() | ||
| 8 | return addr[1] | ||
