当前位置: 首页>>代码示例>>Python>>正文


Python SimpleXMLRPCServer.server_close方法代码示例

本文整理汇总了Python中SimpleXMLRPCServer.server_close方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleXMLRPCServer.server_close方法的具体用法?Python SimpleXMLRPCServer.server_close怎么用?Python SimpleXMLRPCServer.server_close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleXMLRPCServer的用法示例。


在下文中一共展示了SimpleXMLRPCServer.server_close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Network

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import server_close [as 别名]
class Network(object):
    def __init__(self, config,log):
        self.log = log
        
        xmlport = config.getValue("xmlport")
        xmlhost = config.getValue("xmlhost")
        udpport = config.getValue("udpport")
        udphost = config.getValue("udphost")

        self.xml = SimpleXMLRPCServer((xmlhost, xmlport))
        self.udp = netServer(udphost,udpport,log)

        log.StartupMessage("* Attempting to start XML-RPC Server")
        self.udp.serve_forever()
        self.xmlThread = Thread( target = self.startXMLRPCServer )
        self.xmlThread.setDaemon( True )
        self.xmlThread.start()
        log.StartupMessage( "    XML-RPC Server is up at port %d" % xmlport)
        
    def register_function(self,func,funcname):
        self.xml.register_function(func,funcname)
        self.udp.register_function(func,funcname)
        self.log.Notice("Registered funtion %s for network access" % funcname)

    def stopServices(self):
        self.udp.stopServer()
        self.udp.join()
        
        self.log.StartupMessage("* Attempting to stop XML-RPC Server")
        self.xml.server_close()
        #self.xmlThread.join()

    def startXMLRPCServer(self):
        self.xml.serve_forever()
开发者ID:nojan1,项目名称:IHouseServer,代码行数:36,代码来源:network.py

示例2: StatusCollector

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import server_close [as 别名]
        '''
        _logger.error('StatusCollector has died. Exiting program.')
        # Stop the XML-RPC server to exit serve_forever
        global stopping
        stopping = True
        serverXMLRPC.server_close()

    # Instantiate the StatusCollector and start the XML-RPC server
    try:
        # Create our StatusCollector which talks to the Spectracom
        collector = StatusCollector('timeserver', '/data/hcr/spectracom_log',
                                    onStatusCollectorFailure)
        # The main thread is devoted to just running the XML-RPC server. This
        # will finish when a SIGINT is received (i.e., via ^C) or a SIGTERM
        # is received (e.g., via a 'kill' command).
        serverXMLRPC.serve_forever()
    except socket.error as e:
        # Ignore socket.error if we're stopping the server, otherwise
        # complain and exit
        if (not stopping):
            _logger.error('Exiting on XML-RPC server socket error: %s' % (e))
            serverXMLRPC.server_close()

    # Perform a clean shutdown of the XML-RPC server
    serverXMLRPC.shutdown()
    
    # Unregister with procmap
    procmapUnregister()

    _logger.info('Finished ' + time.asctime())
开发者ID:NCAR,项目名称:HCR_instrument,代码行数:32,代码来源:SpectracomDaemon.py

示例3: Exception

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import server_close [as 别名]
        if match is None:
            raise Exception('The function called must be part of the app object')

        try:
            func = eval(method)
        except:
            raise Exception('Method %s is does not exist' % method)

        #call the function if it is exposed
        if func is not None:
            result = func(*params)
            if result[0].value.has_key('value'):
                return result[0].value['value'].value
            else:
                raise Exception('Return type is not currently supported by Marionette Server')

if __name__ == '__main__':
    server = SimpleXMLRPCServer(("localhost", 21777), requestHandler=SimpleXMLRPCRequestHandler, allow_none = True)
    server.register_introspection_functions()

    args = ParseArgs.ParseArgs(sys.argv)
    app = NescApp.NescApp(args.buildDir, args.motecom, tosbase=False, localCommOnly=True)
    myFunctions = MarionetteServer(app)
    
    server.register_instance(myFunctions, allow_dotted_names = True)

    try:
        server.serve_forever()
    finally:
        server.server_close()
开发者ID:Habib2014,项目名称:tinyos-2.x-contrib,代码行数:32,代码来源:MarionetteServer.py


注:本文中的SimpleXMLRPCServer.server_close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。