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)))
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))
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))
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)))
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)))
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)))