Interactive/StartHosting.py

# (C) Copyright 2009 Autodesk, Inc.  All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license
# agreement provided at the time of installation or download, or which
# otherwise accompanies this software in either electronic or hard copy
# form.

# From the bin directory, run with -script FullPath/StartHosting.py.
# or drag StartHosting.py file onto the shortcut.  This will start
# a hosted session with the specified parameters:

HOSTED_SESSION_NAME = "Hosted Session"
HOSTED_SESSION_PORT = 8000
HOSTED_CLOCK_SYNC = (False,)

import socket

from ScriptRunner        import ScriptRunner

class StartHosting( ScriptRunner ):
    def Main( self ):
        """
        This will start the hosted session
        """
        host = socket.gethostname()
        self.sendMessage( 'START_SERVER',
                          (HOSTED_SESSION_NAME,
                           host,
                           HOSTED_SESSION_PORT,
                           HOSTED_CLOCK_SYNC))


# ===============================================================
def instantiate( scriptName, args ):
    return StartHosting( scriptName, args )
# ===============================================================