INNER CODE UNIT · Python

_listen_socket

wolfSSL/wolfssl · scripts/multi-msg-record.py:196

def _listen_socket():
    """Bind a listening TCP socket on localhost with the standard test timeout.

    The port is read back from the socket that keeps it, rather than from a
    throwaway one that is closed first: closing it leaves a window in which
    anything else on the machine can take the port before the real bind.
    """
    srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    srv.bind(("127.0.0.1", 0))
    srv.listen(1)
    srv.settimeout(15)
    return srv, srv.getsockname()[1]


def _run_wolf_client(port, version, cipher, extra=()):
    """Invoke the wolfSSL example client against 127.0.0.1:port.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…