本文整理汇总了Python中twisted.application.internet.StreamServerEndpointService.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python StreamServerEndpointService.__init__方法的具体用法?Python StreamServerEndpointService.__init__怎么用?Python StreamServerEndpointService.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.application.internet.StreamServerEndpointService
的用法示例。
在下文中一共展示了StreamServerEndpointService.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twisted.application.internet import StreamServerEndpointService [as 别名]
# 或者: from twisted.application.internet.StreamServerEndpointService import __init__ [as 别名]
def __init__(self, device):
'''
Initialization of UPnP server
'''
self.upnp = UPnP(device)
self.device = device
self.upnp.parent = self
self.site = server.Site(self.upnp)
edp = endpoints.serverFromString(reactor, "tcp:0")
StreamServerEndpointService.__init__(self, edp, self.site)
self._choosenPort = None
示例2: __init__
# 需要导入模块: from twisted.application.internet import StreamServerEndpointService [as 别名]
# 或者: from twisted.application.internet.StreamServerEndpointService import __init__ [as 别名]
def __init__(self, res):
'''
Initialization of UPnP server
'''
self.resource = res
# self.resource = static.File(
# '/home/babe/Projets/eclipse/onDemand/src/web/')
edp = endpoints.serverFromString(reactor, b'tcp:0')
StreamServerEndpointService.__init__(
self, edp, server.Site(self.resource))
self._choosenPort = None
示例3: __init__
# 需要导入模块: from twisted.application.internet import StreamServerEndpointService [as 别名]
# 或者: from twisted.application.internet.StreamServerEndpointService import __init__ [as 别名]
def __init__(self, config):
SimarglClient.__init__(self, config)
from twisted.internet import reactor
self.factory = SimarglServerFactory(self)
StreamServerEndpointService.__init__(
self,
TCP4ServerEndpoint(reactor, int(config.get('port', 9666)), interface=config.get('host')),
self.factory
)
示例4: __init__
# 需要导入模块: from twisted.application.internet import StreamServerEndpointService [as 别名]
# 或者: from twisted.application.internet.StreamServerEndpointService import __init__ [as 别名]
def __init__(self, device):
'''
Initialization of UPnP server
'''
self.upnp = UPnP(device)
self.devices = [device]
device.parent = self
self.upnp.parent = self
self.site = server.Site(self.upnp)
edp = endpoints.serverFromString(reactor, "tcp:0")
StreamServerEndpointService.__init__(self, edp, self.site)
self._choosenPort = None
for service in device.services:
service.control_resource = TwistedWebResource(service.app)
service.event_resource = ServiceEventResource(service)
service.resource = ServiceResource(service)
示例5: __init__
# 需要导入模块: from twisted.application.internet import StreamServerEndpointService [as 别名]
# 或者: from twisted.application.internet.StreamServerEndpointService import __init__ [as 别名]
def __init__(self, debug, basedir, conf):
'''
Initialization of web and websocket servers
'''
self.playing = False
self.conf = conf
self.recording = False
self.analysing = False
self.serving = False
self.opened = False
self.analyzed = {}
self.analyzed['cocktail'] = 0
self.analyzed['result'] = ''
self.port = str(conf.httpport)
self.debug = debug
self.langage = conf.langage
self.dbsession = conf.dbsession
self.inports = []
self.outports = []
self.sysports = [(0,0),(0,0)]
self.page = Dispatcher(debug, basedir, conf)
print("installdir= %s" % basedir)
self.page.parent = self
self.site = server.Site(self.page)
self.site.protocol = HTTPChannelHixie76Aware
if isinstance(conf.httpport, int):
edp = endpoints.serverFromString(reactor, "tcp:"+str(conf.httpport))
else:
edp = endpoints.serverFromString(reactor, conf.httpport)
StreamServerEndpointService.__init__(self, edp, self.site)
self.wsfactory = SeqFactory(debug, self.endpoint._port)
self.wsfactory.protocol = PyanoTCP
self.wsfactory.setProtocolOptions(allowHixie76 = True)
self.wsfactory.parent = self
self.wsresource = WebSocketResource(self.wsfactory)
self.page.putChild("ws", self.wsresource)