本文整理汇总了Python中gevent.baseserver.BaseServer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BaseServer.__init__方法的具体用法?Python BaseServer.__init__怎么用?Python BaseServer.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gevent.baseserver.BaseServer
的用法示例。
在下文中一共展示了BaseServer.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, *args, **kwargs):
device = kwargs.pop('device')
self.link_name = kwargs.pop('url')
e_kwargs = dict(baudrate=kwargs.pop('baudrate', None),
newline=kwargs.pop('newline', None))
BaseServer.__init__(self, None, *args, **kwargs)
EmulatorServerMixin.__init__(self, device, **e_kwargs)
示例2: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, host, port, handle=None, backlog=None, spawn='default', **ssl_args):
listener = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
listener.bind((host, int(port)))
BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn)
self.delay = self.min_delay
self._recv_event = None
self._start_receving_timer = None
示例3: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args):
if ssl_args:
for arg in ssl_args:
if arg not in self._allowed_ssl_args:
raise TypeError('StreamServer.__init__() got an unexpected keyword argument %r' % arg)
from gevent.ssl import wrap_socket
self.wrap_socket = wrap_socket
self.ssl_args = ssl_args
self.ssl_enabled = True
else:
self.ssl_enabled = False
BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn)
self.delay = self.min_delay
self._accept_event = None
self._start_accepting_timer = None
示例4: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args):
BaseServer.__init__(self, listener, handle=handle, spawn=spawn)
try:
if ssl_args:
ssl_args.setdefault('server_side', True)
from gevent.ssl import wrap_socket
self.wrap_socket = wrap_socket
self.ssl_args = ssl_args
else:
self.ssl_args = None
if backlog is not None:
if hasattr(self, 'socket'):
raise TypeError('backlog must be None when a socket instance is passed')
self.backlog = backlog
except:
self.close()
raise
示例5: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args):
if ssl_args:
ssl_args.setdefault('server_side', True)
try:
from gevent.ssl import wrap_socket
except ImportError:
wrap_socket = _import_sslold_wrap_socket()
if wrap_socket is None:
raise
self.wrap_socket = wrap_socket
self.ssl_args = ssl_args
self.ssl_enabled = True
else:
self.ssl_enabled = False
BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn)
self.delay = self.min_delay
self._accept_event = None
self._start_accepting_timer = None
示例6: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args):
BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn)
self.delay = self.min_delay
self._recv_event = None
self._start_receving_timer = None
示例7: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, *args, **kwargs):
# The raw (non-gevent) socket, if possible
self._socket = None
BaseServer.__init__(self, *args, **kwargs)
from gevent.lock import Semaphore
self._writelock = Semaphore()
示例8: __init__
# 需要导入模块: from gevent.baseserver import BaseServer [as 别名]
# 或者: from gevent.baseserver.BaseServer import __init__ [as 别名]
def __init__(self, listener, handle=None, backlog=None, spawn='default', default_response_headers='default'):
BaseServer.__init__(self, listener, handle=handle, backlog=backlog, spawn=spawn)
self.http = None
if default_response_headers != 'default':
self.default_response_headers = default_response_headers