• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tcpserver.TCPServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

 def __init__(self, app, hostname, io_loop=None, ssl_options=None, **kwargs):
     log.warn('Graphite listener is started -- if you do not need graphite, turn it off in datadog.conf.')
     log.warn('Graphite relay uses pickle to transport messages. Pickle is not secured against remote execution exploits.')
     log.warn('See http://blog.nelhage.com/2011/03/exploiting-pickle/ for more details')
     self.app = app
     self.hostname = hostname
     TCPServer.__init__(self, io_loop=io_loop, ssl_options=ssl_options, **kwargs)
开发者ID:AltSchool,项目名称:dd-agent,代码行数:7,代码来源:graphite.py


示例2: initialize

 def initialize(
     self,
     request_callback,
     no_keep_alive=False,
     io_loop=None,
     xheaders=False,
     ssl_options=None,
     protocol=None,
     decompress_request=False,
     chunk_size=None,
     max_header_size=None,
     idle_connection_timeout=None,
     body_timeout=None,
     max_body_size=None,
     max_buffer_size=None,
 ):
     self.request_callback = request_callback
     self.no_keep_alive = no_keep_alive
     self.xheaders = xheaders
     self.protocol = protocol
     self.conn_params = HTTP1ConnectionParameters(
         decompress=decompress_request,
         chunk_size=chunk_size,
         max_header_size=max_header_size,
         header_timeout=idle_connection_timeout or 3600,
         max_body_size=max_body_size,
         body_timeout=body_timeout,
     )
     TCPServer.__init__(
         self, io_loop=io_loop, ssl_options=ssl_options, max_buffer_size=max_buffer_size, read_chunk_size=chunk_size
     )
     self._connections = set()
开发者ID:spengx,项目名称:tornado,代码行数:32,代码来源:httpserver.py


示例3: __init__

 def __init__(self, connect_cb, disconnect_cb, data_cb, port=12345, host=''):
     TCPServer.__init__(self)
     self.connect_callback = connect_cb
     self.disconnect_callback = disconnect_cb
     self.data_callback = data_cb
     self.clients = []
     self.listen(port, host)
     logging.info('Listening on port: %i', port)
开发者ID:lmas,项目名称:scrapyard,代码行数:8,代码来源:network.py


示例4: __init__

 def __init__(self, storage, sender, io_loop=None, **kwargs):
     TCPServer.__init__(self, io_loop=io_loop, **kwargs)
     self.storage = storage
     if not os.path.exists(self.storage):
         os.mkdir(self.storage)
     self.loop = io_loop or ioloop.IOLoop.current()
     self.send_mail = sender
     self.loop.call_later(10, self.send_mails)
开发者ID:chaoallsome,项目名称:toxmail,代码行数:8,代码来源:smtp.py


示例5: __init__

 def __init__(self, request_callback, io_loop=None, auth_password=None, **kwargs):
     self.request_callback = request_callback
     self.stats = Stats()
     self.auth_password = auth_password
     self.require_auth = False
     if self.auth_password:
         self.require_auth = True
     TCPServer.__init__(self, io_loop=io_loop, **kwargs)
开发者ID:ChinaQuants,项目名称:datafeed,代码行数:8,代码来源:server.py


示例6: __init__

 def __init__(self, request_callback, no_keep_alive=False, io_loop=None,
              xheaders=False, ssl_options=None, protocol=None, **kwargs):
     self.request_callback = request_callback
     self.no_keep_alive = no_keep_alive
     self.xheaders = xheaders
     self.protocol = protocol
     TCPServer.__init__(self, io_loop=io_loop, ssl_options=ssl_options,
                        **kwargs)
开发者ID:08opt,项目名称:tornado,代码行数:8,代码来源:httpserver.py


示例7: __init__

    def __init__(self, port, prt_types, prt_types_handlers):

        PNFPServer.__init__(self, prt_types, prt_types_handlers)
        TCPServer.__init__(self)

        self.port = int(port)
        self.connection = None

        self.listen(self.port)
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:9,代码来源:vbspserver.py


示例8: __init__

 def __init__(self, io_loop=None, ssl_options=None, gp_module=False, **kwargs):
     self.logger = logging.getLogger(self.__class__.__name__)
     self.gp_module = gp_module
     try:
         TCPServer.__init__(self, ssl_options=ssl_options, **kwargs)
     except:
         etype, evalue, etb = sys.exc_info()
         self.logger.error("Could not create tcp server. Exception: %s, Error: %s." % (etype, evalue))
         self.gp_module.shutDown()
开发者ID:dstore-dbap,项目名称:LumberMill,代码行数:9,代码来源:TcpServer.py


示例9: __init__

    def __init__ (self, db_conn, cursor, role):
        self.conn = db_conn
        self.cur = cursor
        self.role = role

        if self.role == 'ota':
            self.conn_pool = DeviceServer.accepted_ota_conns
        else:
            self.conn_pool = DeviceServer.accepted_xchange_conns

        TCPServer.__init__(self)
开发者ID:mplogas,项目名称:Wio_Link,代码行数:11,代码来源:server.py


示例10: __init__

    def __init__(self, port, pt_types, pt_types_handlers):

        PNFPServer.__init__(self, pt_types, pt_types_handlers)
        TCPServer.__init__(self)

        self.port = int(port)
        self.connection = None

        self.listen(self.port)

        self.lvaps = {}
        self.__assoc_id = 0
开发者ID:archam,项目名称:empower-runtime,代码行数:12,代码来源:lvappserver.py


示例11: __init__

    def __init__(self, torrent, max_peers=50, download_path='downloads', peer_id=peer_id(), storage_class=DiskStorage):
        TCPServer.__init__(self)

        self.peer_id = peer_id
        self.torrent = torrent

        self.max_peers = max_peers
        self.connected_peers = set()
        self.connecting_peers = set()
        self.unconnected_peers = set()

        self.storage = storage_class.from_torrent(torrent, base_path=download_path)
开发者ID:Bivimbob,项目名称:torrent,代码行数:12,代码来源:server.py


示例12: __init__

    def __init__(self, config, agentType):
        self._config = config
        self._log = getLogger()
        self._client = AsyncHTTPClient()
        self._syncClient = HTTPClient()

        self._agentType = agentType 
        self._parseConfig()

        self._tunnel = 0
        self._hangUp = False

        self._stream = None

        TCPServer.__init__(self)
开发者ID:heartshare,项目名称:mtunnel,代码行数:15,代码来源:baseagent.py


示例13: __init__

    def __init__(self, env):
        self._env = env
        
        self._client = AsyncHTTPClient()

        self._syncClient = HTTPClient()


        config = env.config

        self._cid = config.channel
        self._url = '%s://%s' % (config.protocol, config.server)

        self._hangUp = False

        TCPServer.__init__(self)
开发者ID:heartshare,项目名称:mtunnel,代码行数:16,代码来源:fproxy.py


示例14: initialize

 def initialize(
     self,
     request_callback: Union[
         httputil.HTTPServerConnectionDelegate,
         Callable[[httputil.HTTPServerRequest], None],
     ],
     no_keep_alive: bool = False,
     xheaders: bool = False,
     ssl_options: Union[Dict[str, Any], ssl.SSLContext] = None,
     protocol: str = None,
     decompress_request: bool = False,
     chunk_size: int = None,
     max_header_size: int = None,
     idle_connection_timeout: float = None,
     body_timeout: float = None,
     max_body_size: int = None,
     max_buffer_size: int = None,
     trusted_downstream: List[str] = None,
 ) -> None:
     # This method's signature is not extracted with autodoc
     # because we want its arguments to appear on the class
     # constructor. When changing this signature, also update the
     # copy in httpserver.rst.
     self.request_callback = request_callback
     self.xheaders = xheaders
     self.protocol = protocol
     self.conn_params = HTTP1ConnectionParameters(
         decompress=decompress_request,
         chunk_size=chunk_size,
         max_header_size=max_header_size,
         header_timeout=idle_connection_timeout or 3600,
         max_body_size=max_body_size,
         body_timeout=body_timeout,
         no_keep_alive=no_keep_alive,
     )
     TCPServer.__init__(
         self,
         ssl_options=ssl_options,
         max_buffer_size=max_buffer_size,
         read_chunk_size=chunk_size,
     )
     self._connections = set()  # type: Set[HTTP1ServerConnection]
     self.trusted_downstream = trusted_downstream
开发者ID:bdarnell,项目名称:tornado,代码行数:43,代码来源:httpserver.py


示例15: start

    def start(self):
        """Starts the service on the configured port and host, or uses an
        OS-assigned port if not provided.
        """
        sock, port, host = self.build_socket()
        self.port = port
        self.host = host

        self.server = TCPServer()
        self.server.handle_stream = self.handle_stream
        self.server.add_socket(sock)
        self.server.start(self.procs)
开发者ID:jsober,项目名称:denim,代码行数:12,代码来源:net.py


示例16: __init__

    def __init__(self, request_callback, no_keep_alive=False, io_loop=None,
                 xheaders=False, ssl_options=None, protocol=None, gzip=False,
                 chunk_size=None, max_header_size=None,
                 idle_connection_timeout=None, body_timeout=None,
                 max_body_size=None, max_buffer_size=None):

        # 回调对象,一个application对象,具有handlers的list
        self.request_callback = request_callback

        self.no_keep_alive = no_keep_alive
        self.xheaders = xheaders
        self.protocol = protocol
        self.conn_params = HTTP1ConnectionParameters(  # 基本的连接参数
            use_gzip=gzip,
            chunk_size=chunk_size,
            max_header_size=max_header_size,
            header_timeout=idle_connection_timeout or 3600,
            max_body_size=max_body_size,
            body_timeout=body_timeout)
        TCPServer.__init__(self, io_loop=io_loop, ssl_options=ssl_options,
                           max_buffer_size=max_buffer_size,
                           read_chunk_size=chunk_size)
        self._connections = set()  # 保存全部的连接
开发者ID:ColorFuzzy,项目名称:tornado_code,代码行数:23,代码来源:httpserver.py


示例17: start

 def start(self):
     self.tcp_server = TCPServer(max_buffer_size=MAX_BUFFER_SIZE,
                                 **self.server_args)
     self.tcp_server.handle_stream = self._handle_stream
     backlog = int(dask.config.get('distributed.comm.socket-backlog'))
     for i in range(5):
         try:
             # When shuffling data between workers, there can
             # really be O(cluster size) connection requests
             # on a single worker socket, make sure the backlog
             # is large enough not to lose any.
             sockets = netutil.bind_sockets(self.port, address=self.ip,
                                            backlog=backlog)
         except EnvironmentError as e:
             # EADDRINUSE can happen sporadically when trying to bind
             # to an ephemeral port
             if self.port != 0 or e.errno != errno.EADDRINUSE:
                 raise
             exc = e
         else:
             self.tcp_server.add_sockets(sockets)
             break
     else:
         raise exc
开发者ID:tomMoral,项目名称:distributed,代码行数:24,代码来源:tcp.py


示例18: __init__

 def __init__(self):
     TCPServer.__init__(self)
     self.client_list = []
开发者ID:GreedyOsori,项目名称:Chat,代码行数:3,代码来源:demo_server.py


示例19: __init__

 def __init__(self, no_keep_alive=False, protocol=None, **kwargs):
     self.no_keep_alive = no_keep_alive
     self.protocol = protocol
     TCPServer.__init__(self, **kwargs)
开发者ID:delongw,项目名称:breadtrip_lib_py,代码行数:4,代码来源:server.py


示例20: __init__

 def __init__ (self, db_conn, cursor, role):
     self.conn = db_conn
     self.cur = cursor
     self.role = role
     TCPServer.__init__(self)
开发者ID:Intellifora,项目名称:Wio_Link,代码行数:5,代码来源:server.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python template.DictLoader类代码示例发布时间:2022-05-27
下一篇:
Python tcpclient.TCPClient类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap