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


Python baseserver.BaseServer类代码示例

本文整理汇总了Python中gevent.baseserver.BaseServer的典型用法代码示例。如果您正苦于以下问题:Python BaseServer类的具体用法?Python BaseServer怎么用?Python BaseServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: pre_start

 def pre_start(self):
     BaseServer.pre_start(self)
     # make SSL work:
     if self.ssl_enabled:
         self._handle = self.wrap_socket_and_handle
     else:
         self._handle = self.handle
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:7,代码来源:server.py

示例2: set_handle

 def set_handle(self, handle):
     BaseServer.set_handle(self, handle)
     # make SSL work:
     if self.ssl_enabled:
         self._handle = self.wrap_socket_and_handle
     else:
         self._handle = self.handle
开发者ID:SMFOSS,项目名称:gevent,代码行数:7,代码来源:server.py

示例3: __init__

 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)
开发者ID:tiagocoutinho,项目名称:bliss,代码行数:7,代码来源:emulator.py

示例4: kill

 def kill(self):
     try:
         BaseServer.kill(self)
     finally:
         self.__dict__.pop('_handle', None)
         pool = getattr(self, 'pool', None)
         if pool is not None:
             pool._semaphore.unlink(self._start_accepting_if_started)
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:8,代码来源:server.py

示例5: __init__

    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
开发者ID:olegfedoseev,项目名称:pinba2zmq,代码行数:9,代码来源:dgramserver.py

示例6: __init__

 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
开发者ID:SMFOSS,项目名称:gevent,代码行数:15,代码来源:server.py

示例7: __init__

 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
开发者ID:carriercomm,项目名称:gevent,代码行数:17,代码来源:server.py

示例8: __init__

 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
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:18,代码来源:server.py

示例9: set_spawn

 def set_spawn(self, spawn):
     BaseServer.set_spawn(self, spawn)
     if self.pool is not None:
         self.pool._semaphore.rawlink(self._start_accepting_if_started)
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:4,代码来源:server.py

示例10: set_listener

 def set_listener(self, listener, backlog=None):
     BaseServer.set_listener(self, listener, backlog=backlog)
     try:
         self.socket = self.socket._sock
     except AttributeError:
         pass
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:6,代码来源:server.py

示例11: set_spawn

 def set_spawn(self, spawn):
     BaseServer.set_spawn(self, spawn)
     if self.pool is not None:
         self.pool._semaphore.rawlink(self._start_receiving)
开发者ID:5pld3y,项目名称:conpot,代码行数:4,代码来源:udp_server.py

示例12: __init__

 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
开发者ID:5pld3y,项目名称:conpot,代码行数:5,代码来源:udp_server.py

示例13: __init__

 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()
开发者ID:dbrehmer,项目名称:Knowself,代码行数:6,代码来源:server.py

示例14: __init__

 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
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:5,代码来源:http.py

示例15: set_listener

 def set_listener(self, listener):
     BaseServer.set_listener(self, listener)
     try:
         self.socket = self.socket._sock
     except AttributeError:
         pass
开发者ID:carriercomm,项目名称:gevent,代码行数:6,代码来源:server.py


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