basicViewerPython.py
def sdk_main():
    """sdk_main() is the main method for the SDK thread.  It initializes the
    SDK, creates the SDK objects, and runs the SDK event loop.  When sdk_main()
    exits, the SDK thread has finished.
    """
    try:
        global using_cloud, direct_tcp_add_on_code, viewer_conn

        # Create a logger with outputs to sys.stderr
        vncsdk.Logger.create_stderr_logger()

        # Create a file DataStore for storing persistent data for the viewer.
        # Ideally this would be created in a directory that only the viewer
        # user has access to.
        vncsdk.DataStore.create_file_store("dataStore.txt")

        # Initialize SDK and optional Add-Ons
        vncsdk.init()
        if not using_cloud:
            try:
                vncsdk.enable_add_on(direct_tcp_add_on_code)
            except Exception as e:
                print("Failed to enable Direct TCP add-on: " + str(e))
                viewer_widget.signal_disconnected.emit(None)
                return

        # Create the SDK Viewer objects, and begin the connection to the Server
        viewer_conn = ViewerConn()
        viewer_handler = viewer_conn.viewer.get_connection_handler()

        if using_cloud:
            # Make a Cloud connection
            print("Connecting via VNC Cloud")
            print("    local address: {addr}".format(addr=LOCAL_CLOUD_ADDRESS))
            print("     peer address: {addr}".format(addr=PEER_CLOUD_ADDRESS))
            with vncsdk.CloudConnector(LOCAL_CLOUD_ADDRESS,
                                       LOCAL_CLOUD_PASSWORD) \
                    as cloud_connector:
                cloud_connector.connect(PEER_CLOUD_ADDRESS, viewer_handler)
        else:
            # Make a Direct TCP connection.
            # Ignore this if you do not intend to use the Direct TCP add-on
            print("Connecting to host address: {address} port: {port}".format(
                  address=TCP_ADDRESS, port=str(TCP_PORT)))
            with vncsdk.DirectTcpConnector() as tcp_connector:
                tcp_connector.connect(TCP_ADDRESS, TCP_PORT, viewer_handler)

        # Run the SDK's event loop.  This will return when the main thread
        # calls vncsdk.EventLoop.stop(), allowing the SDK thread to exit.
        vncsdk.EventLoop.run()

    except:
        import traceback
        traceback.print_exc()
        viewer_widget.signal_disconnected.emit(None)

    finally:
        if viewer_conn:
            viewer_conn.destroy()
sdk_main() is the main method for the SDK thread.  It initializes the
    SDK, creates the SDK objects, and runs the SDK event loop.  When sdk_main()
    exits, the SDK thread has finished.
    
sdk_main() is the main method for the SDK thread.  It initializes the
SDK, creates the SDK objects, and runs the SDK event loop.  When sdk_main()
exits, the SDK thread has finished.
sdk_main () is the main method for the SDK thread . It initializes the SDK creates the SDK objects and runs the SDK event loop . When sdk_main () exits the SDK thread has finished .
def sdk_main():
    try:
        global using_cloud, direct_tcp_add_on_code, viewer_conn
        vncsdk.Logger.create_stderr_logger()
        vncsdk.DataStore.create_file_store("dataStore.txt")
        vncsdk.init()
        if not using_cloud:
            try:
                vncsdk.enable_add_on(direct_tcp_add_on_code)
            except Exception as e:
                print("Failed to enable Direct TCP add-on: " + str(e))
                viewer_widget.signal_disconnected.emit(None)
                return
        viewer_conn = ViewerConn()
        viewer_handler = viewer_conn.viewer.get_connection_handler()
        if using_cloud:
            print("Connecting via VNC Cloud")
            print("    local address: {addr}".format(addr=LOCAL_CLOUD_ADDRESS))
            print("     peer address: {addr}".format(addr=PEER_CLOUD_ADDRESS))
            with vncsdk.CloudConnector(LOCAL_CLOUD_ADDRESS,
                                       LOCAL_CLOUD_PASSWORD) \
                    as cloud_connector:
                cloud_connector.connect(PEER_CLOUD_ADDRESS, viewer_handler)
        else:
            print("Connecting to host address: {address} port: {port}".format(
                  address=TCP_ADDRESS, port=str(TCP_PORT)))
            with vncsdk.DirectTcpConnector() as tcp_connector:
                tcp_connector.connect(TCP_ADDRESS, TCP_PORT, viewer_handler)
        vncsdk.EventLoop.run()
    except:
        import traceback
        traceback.print_exc()
        viewer_widget.signal_disconnected.emit(None)
    finally:
        if viewer_conn:
            viewer_conn.destroy()
def sdk_main ( ) : try : global using_cloud , direct_tcp_add_on_code , viewer_conn vncsdk . Logger . create_stderr_logger ( ) vncsdk . DataStore . create_file_store ( "dataStore.txt" ) vncsdk . init ( ) if not using_cloud : try : vncsdk . enable_add_on ( direct_tcp_add_on_code ) except Exception as e : print ( "Failed to enable Direct TCP add-on: " + str ( e ) ) viewer_widget . signal_disconnected . emit ( None ) return viewer_conn = ViewerConn ( ) viewer_handler = viewer_conn . viewer . get_connection_handler ( ) if using_cloud : print ( "Connecting via VNC Cloud" ) print ( "    local address: {addr}" . format ( addr = LOCAL_CLOUD_ADDRESS ) ) print ( "     peer address: {addr}" . format ( addr = PEER_CLOUD_ADDRESS ) ) with vncsdk . CloudConnector ( LOCAL_CLOUD_ADDRESS , LOCAL_CLOUD_PASSWORD ) as cloud_connector : cloud_connector . connect ( PEER_CLOUD_ADDRESS , viewer_handler ) else : print ( "Connecting to host address: {address} port: {port}" . format ( address = TCP_ADDRESS , port = str ( TCP_PORT ) ) ) with vncsdk . DirectTcpConnector ( ) as tcp_connector : tcp_connector . connect ( TCP_ADDRESS , TCP_PORT , viewer_handler ) vncsdk . EventLoop . run ( ) except : import traceback traceback . print_exc ( ) viewer_widget . signal_disconnected . emit ( None ) finally : if viewer_conn : viewer_conn . destroy ( )
sdk_main() is the main method for the SDK thread.
sdk_main () is the main method for the SDK thread .
"""sdk_main() is the main method for the SDK thread.  It initializes the
    SDK, creates the SDK objects, and runs the SDK event loop.  When sdk_main()
    exits, the SDK thread has finished.
    """ # Create a logger with outputs to sys.stderr # Create a file DataStore for storing persistent data for the viewer. # Ideally this would be created in a directory that only the viewer # user has access to. # Initialize SDK and optional Add-Ons # Create the SDK Viewer objects, and begin the connection to the Server # Make a Cloud connection # Make a Direct TCP connection. # Ignore this if you do not intend to use the Direct TCP add-on # Run the SDK's event loop.  This will return when the main thread # calls vncsdk.EventLoop.stop(), allowing the SDK thread to exit.