gpt4 book ai didi

Python socket ConnectionResetError : [Errno 54] Connection reset by peer vs socket. 错误:[Errno 104] Connection reset by peer

转载 作者:行者123 更新时间:2023-11-28 19:30:12 28 4
gpt4 key购买 nike

我在调试我的代码时遇到问题,因为我无法理解引发的套接字错误。这是回溯。

Traceback (most recent call last):
File "clickpression.py", line 517, in <module> presser.main()
File "clickpression.py", line 391, in main
File "clickpression.py", line 121, in clickpress self.refresh_proxies(country=country)
File "clickpression.py", line 458, in refresh_proxies self.proxies = self.get_proxies(country=country)
File "helpers.py", line 72, in wrapper return func(*args, **kwargs)
File "clickpression.py", line 264, in get_proxies self.settings.SUPER_PROXY).read().decode('utf-8')
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 161, in urlopen return opener.open(url, data, timeout)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 463, in open response = self._open(req, data)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 481, in _open '_open', req)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 441, in _call_chain result = func(*args)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1210, in http_open return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1185, in do_open r = h.getresponse()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1171, in getresponse response.begin()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 351, in begin version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 313, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py", line 374, in readinto return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer

根据 errnoErrno 54errno.EXFULL ,在 python 3 documentation 中解释为 exchange full

根据我的理解,Connection reset by peerErrno 104errno.ECONNRESET

那么errno.EXFULL是什么意思呢?以及为什么 socket 使用 connection reset by peer 描述而不是 exchange full 引发错误。或者这两个错误 errno.EXFULLerrno.ECONNRESET 有什么关系?

附言:我read errno 54 可能与 http 代理有关(我在我的代码中使用代理)。如果是,怎么办?

最佳答案

According to the errno library Errno 54 is errno.EXFULL

您是通过检查 errno.errorcode[54] 确定的吗?无论如何 - 这个 errno 可能有问题。您可以通过查看 errno.h 来验证系统错误代码的含义,例如。 G。在 gcc 的帮助下:

gcc -xc -imacros errno.h -Wp,-P -E <(echo ECONNRESET)

此外,Python documentation说:

To translate a numeric error code to an error message, use os.strerror().

很可能错误编号 54 在您的系统上是 ECONNRESET,而 os.strerror(54) 将证明这一点。

现在您已经验证了 os.strerror(54) 返回 'Exchange full',我很困惑为什么错误编号 54 和错误字符串 由对等方重置的连接 不匹配。如果在使用 strace 或类似东西的系统上发生这种情况,我会通过在受影响的进程上使用 strace -e network 进一步检查操作系统返回了哪个错误。

关于您关于 EXFULL 的问题:它的含义似乎有点依赖于系统; e. G。在 Linux 上,EXFULL 仅从内核中的少数几个位置返回,唯一与网络相关的位置在 br_if.c 中。关于网桥,当找不到可用的网桥端口号时(其他地方在USB和SCSI驱动中)。

关于Python socket ConnectionResetError : [Errno 54] Connection reset by peer vs socket. 错误:[Errno 104] Connection reset by peer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29270895/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com