本文整理汇总了Python中future.backports.socketserver.TCPServer方法的典型用法代码示例。如果您正苦于以下问题:Python socketserver.TCPServer方法的具体用法?Python socketserver.TCPServer怎么用?Python socketserver.TCPServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类future.backports.socketserver
的用法示例。
在下文中一共展示了socketserver.TCPServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: server_bind
# 需要导入模块: from future.backports import socketserver [as 别名]
# 或者: from future.backports.socketserver import TCPServer [as 别名]
def server_bind(self):
"""Override server_bind to store the server name."""
socketserver.TCPServer.server_bind(self)
host, port = self.socket.getsockname()[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port
示例2: __init__
# 需要导入模块: from future.backports import socketserver [as 别名]
# 或者: from future.backports.socketserver import TCPServer [as 别名]
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
logRequests=True, allow_none=False, encoding=None,
bind_and_activate=True, use_builtin_types=False):
self.logRequests = logRequests
SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types)
socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
# [Bug #1222790] If possible, set close-on-exec flag; if a
# method spawns a subprocess, the subprocess shouldn't have
# the listening socket open.
if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
flags |= fcntl.FD_CLOEXEC
fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)