本文整理匯總了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)