Пример #1
0
def serve_socket_helper(sock, secure=False, vdb=None):
    if secure:
        log("requiring authentication")
        try:
            stream = SocketStream.from_secure_server_socket(sock, vdb)
        except:
            log("authenication failed")
            sock.close()
        else:
            log("authentication successful")
            serve_channel(Channel(stream))
    else:
        serve_channel(Channel(SocketStream(sock)))
Пример #2
0
def SecSocketConnection(host, username, password, port = DEFAULT_PORT):
    """shorthand for creating secure socket connections"""
    try:
        stream = SocketStream.from_new_secure_socket(host, port, username, password)
    except:
        raise LoginError("authentication failure")
    return Connection(Channel(stream))
Пример #3
0
def SecSocketConnection(host, username, password, port=DEFAULT_PORT):
    """shorthand for creating secure socket connections"""
    try:
        stream = SocketStream.from_new_secure_socket(host, port, username,
                                                     password)
    except:
        raise LoginError("authentication failure")
    return Connection(Channel(stream))
Пример #4
0
def serve_socket_helper(sock, secure = False, vdb = None):
    if secure:
        log("requiring authentication")
        try:
            stream = SocketStream.from_secure_server_socket(sock, vdb)
        except:
            log("authenication failed")
            sock.close()
        else:
            log("authentication successful")
            serve_channel(Channel(stream))
    else:
        serve_channel(Channel(SocketStream(sock)))
Пример #5
0
def SocketConnection(host, port = DEFAULT_PORT):
    """shorthand for creating a conneciton over a socket to a server"""
    return Connection(Channel(SocketStream.from_new_socket(host, port)))
Пример #6
0
def SocketConnection(host, port=DEFAULT_PORT):
    """shorthand for creating a conneciton over a socket to a server"""
    return Connection(Channel(SocketStream.from_new_socket(host, port)))