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


Python TCPServer.__init__方法代码示例

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


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

示例1: initialize

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
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:DirceuSilvaLabs,项目名称:noc-orchestrator,代码行数:23,代码来源:httpserver.py

示例2: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, stream, address, protocol):
        self.address = address
        # Save the socket's address family now so we know how to
        # interpret self.address even after the stream is closed
        # and its socket attribute replaced with None.
        if stream.socket is not None:
            self.address_family = stream.socket.family
        else:
            self.address_family = None
        # In HTTPServerRequest we want an IP, not a full socket address.
        if (self.address_family in (socket.AF_INET, socket.AF_INET6) and
                address is not None):
            self.remote_ip = address[0]
        else:
            # Unix (or other) socket; fake the remote address.
            self.remote_ip = '0.0.0.0'
        if protocol:
            self.protocol = protocol
        elif isinstance(stream, iostream.SSLIOStream):
            self.protocol = "https"
        else:
            self.protocol = "http"
        self._orig_remote_ip = self.remote_ip
        self._orig_protocol = self.protocol 
开发者ID:DirceuSilvaLabs,项目名称:noc-orchestrator,代码行数:26,代码来源:httpserver.py

示例3: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, stream, address, request_callback, no_keep_alive=False,
                 xheaders=False, protocol=None):
        self.stream = stream
        self.address = address
        # Save the socket's address family now so we know how to
        # interpret self.address even after the stream is closed
        # and its socket attribute replaced with None.
        self.address_family = stream.socket.family
        self.request_callback = request_callback
        self.no_keep_alive = no_keep_alive
        self.xheaders = xheaders
        self.protocol = protocol
        self._clear_request_state()
        # Save stack context here, outside of any request.  This keeps
        # contexts from one request from leaking into the next.
        self._header_callback = stack_context.wrap(self._on_headers)
        self.stream.set_close_callback(self._on_connection_close)
        self.stream.read_until(b"\r\n\r\n", self._header_callback) 
开发者ID:hhstore,项目名称:annotated-py-tornado,代码行数:20,代码来源:httpserver.py

示例4: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, stream, address, protocol):
        self.address = address
        self.protocol = protocol
        # Save the socket's address family now so we know how to
        # interpret self.address even after the stream is closed
        # and its socket attribute replaced with None.
        if stream.socket is not None:
            self.address_family = stream.socket.family
        else:
            self.address_family = None
        # In HTTPServerRequest we want an IP, not a full socket address.
        if (self.address_family in (socket.AF_INET, socket.AF_INET6) and
                address is not None):
            self.remote_ip = address[0]
        else:
            # Unix (or other) socket; fake the remote address.
            self.remote_ip = '0.0.0.0'
        if protocol:
            self.protocol = protocol
        elif isinstance(stream, iostream.SSLIOStream):
            self.protocol = "https"
        else:
            self.protocol = "http"
        self._orig_remote_ip = self.remote_ip
        self._orig_protocol = self.protocol 
开发者ID:hhstore,项目名称:annotated-py-tornado,代码行数:27,代码来源:httpserver.py

示例5: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, stream, address, request_callback, no_keep_alive=False,
                 xheaders=False, protocol=None):
        self.stream = stream
        self.address = address
        # Save the socket's address family now so we know how to
        # interpret self.address even after the stream is closed
        # and its socket attribute replaced with None.
        self.address_family = stream.socket.family
        self.request_callback = request_callback
        self.no_keep_alive = no_keep_alive
        self.xheaders = xheaders
        self.protocol = protocol
        self._request = None
        self._request_finished = False
        self._write_callback = None
        self._close_callback = None
        # Save stack context here, outside of any request.  This keeps
        # contexts from one request from leaking into the next.
        self._header_callback = stack_context.wrap(self._on_headers)
        self.stream.read_until(b"\r\n\r\n", self._header_callback) 
开发者ID:respeaker,项目名称:get_started_with_respeaker,代码行数:22,代码来源:httpserver.py

示例6: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, io_loop=None, **kwargs):
        TCPServer.__init__(self, io_loop=io_loop, **kwargs) 
开发者ID:thsheep,项目名称:Python_Study,代码行数:4,代码来源:sender.py

示例7: __init__

# 需要导入模块: from tornado.tcpserver import TCPServer [as 别名]
# 或者: from tornado.tcpserver.TCPServer import __init__ [as 别名]
def __init__(self, *args, **kwargs):
        # Ignore args to __init__; real initialization belongs in
        # initialize since we're Configurable. (there's something
        # weird in initialization order between this class,
        # Configurable, and TCPServer so we can't leave __init__ out
        # completely)
        pass 
开发者ID:hhstore,项目名称:annotated-py-tornado,代码行数:9,代码来源:httpserver.py


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