當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。