本文整理汇总了Python中socket.socket.fileno方法的典型用法代码示例。如果您正苦于以下问题:Python socket.fileno方法的具体用法?Python socket.fileno怎么用?Python socket.fileno使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socket.socket
的用法示例。
在下文中一共展示了socket.fileno方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from socket import socket [as 别名]
# 或者: from socket.socket import fileno [as 别名]
def __init__(self, sock: socket.socket, host: bytes, port: int, loop: LoopBase = None) -> None:
EventSource.__init__(self, loop)
self.socket = sock
self.host = host
self.port = port
self.tcp_connected = True # we assume a connected socket
self._input_paused = True # we start with input paused
self._output_paused = False
self._closing = False
self._write_buffer = [] # type: list[bytes]
self.register_fd(sock.fileno())
self.on("fd_readable", self.handle_readable)
self.on("fd_writable", self.handle_writable)
self.on("fd_close", self._handle_close)
示例2: remove_socket
# 需要导入模块: from socket import socket [as 别名]
# 或者: from socket.socket import fileno [as 别名]
def remove_socket(self, sock: socket.socket):
del self.other_sockets[sock.fileno()]
self.poll.unregister(sock.fileno())
示例3: add_socket
# 需要导入模块: from socket import socket [as 别名]
# 或者: from socket.socket import fileno [as 别名]
def add_socket(self, sock: socket.socket):
self.other_sockets[sock.fileno()] = sock
self.poll.register(sock.fileno(), select.EPOLLIN)