(sock)
return sock.getsockname()[1]
Get the port the socket is bound to.
Get the port the socket is bound to.
Get the port the socket is bound to .
def get_port(sock):
    """Get the port the socket is bound to."""
    return sock.getsockname()[1]
def get_port ( sock ) : return sock . getsockname ( ) [ 1 ]