diff options
| author | Egor Tensin <egor@tensin.name> | 2023-12-28 01:00:45 +0100 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2023-12-28 01:00:45 +0100 |
| commit | a9ae33c4b9dbe566d2ada07affb8b5a135f9b6eb (patch) | |
| tree | 72b47c96da722d5e034af789f4af432e3fdfa051 /test/py/lib/net.py | |
| parent | json: factor out json_object_put into json_free (diff) | |
| download | cimple-a9ae33c4b9dbe566d2ada07affb8b5a135f9b6eb.tar.gz cimple-a9ae33c4b9dbe566d2ada07affb8b5a135f9b6eb.zip | |
test/py/ -> test/src/
Diffstat (limited to 'test/py/lib/net.py')
| -rw-r--r-- | test/py/lib/net.py | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/test/py/lib/net.py b/test/py/lib/net.py deleted file mode 100644 index 06bfda0..0000000 --- a/test/py/lib/net.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2023 Egor Tensin <egor@tensin.name> -# This file is part of the "cimple" project. -# For details, see https://github.com/egor-tensin/cimple. -# Distributed under the MIT License. - -from contextlib import closing -import socket - - -def random_unused_port(): - with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.bind(('0.0.0.0', 0)) - port = sock.getsockname()[1] - return port |
