tcp_client.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:Telethon 作者: LonamiWebs 项目源码 文件源码
def write(self, data):
        """
        Writes (sends) the specified bytes to the connected peer.

        :param data: the data to send.
        """
        if self._socket is None:
            raise ConnectionResetError()

        # TODO Timeout may be an issue when sending the data, Changed in v3.5:
        # The socket timeout is now the maximum total duration to send all data.
        try:
            self._socket.sendall(data)
        except socket.timeout as e:
            raise TimeoutError() from e
        except BrokenPipeError:
            self._raise_connection_reset()
        except OSError as e:
            if e.errno == errno.EBADF:
                self._raise_connection_reset()
            else:
                raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号