Ejemplo n.º 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)))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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)))
Ejemplo n.º 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)))
Ejemplo n.º 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)))