ConnectionResetError: [Errno 104] Connection reset by peer|4-16

简介: ConnectionResetError: [Errno 104] Connection reset by peer|4-16

python socket 编程,sftp远程读日志文件,取最后的30行返回。收到ConnectionResetError: [Errno 104] Connection reset by peer报错。

最后找到原因是send的数据size太大,服务器端重置了连接

Traceback (most recent call last):

 File "s1.py", line 63, in <module>

   data = tcpCliSock.recv(bufsize).decode()

ConnectionResetError: [Errno 104] Connection  reset by peer

解决办法:把异常by pass

from  socket import error as SocketError

import errno

try:

    ...

    ...

except SocketError as e:

   if e.errno != errno.ECONNRESET:

       raise

   pass

image.png

相关文章
|
4月前
|
网络安全
client_loop: send disconnect: Connection reset by peerB/s4-5
client_loop: send disconnect: Connection reset by peerB/s4-5
|
6月前
|
监控 网络安全
Connection reset by peer的原因
Connection reset by peer的原因
|
8月前
|
网络安全 开发工具 git
解决 OpenSSL SSL_read: Connection was reset, errno 10054的问题
解决 OpenSSL SSL_read: Connection was reset, errno 10054的问题
|
Java 网络安全 Docker
curl: (56) Recv failure: Connection reset by peer
curl: (56) Recv failure: Connection reset by peer
940 0
|
缓存 安全 网络安全
net::ERR_CONNECTION_RESET
`net::ERR_CONNECTION_RESET` 错误通常表示网络连接被重置。这可能是由于以下原因之一导致的: 1. 网络问题: 该错误可能是由于网络中断、不稳定的连接或基础设备故障等引起的。请确保你的网络连接正常,并尝试刷新页面或重新启动网络设备。 2. 防火墙或安全软件: 有时,防火墙或某些安全软件可能会干扰网络连接并重置它。尝试禁用防火墙或安全软件,然后再次访问网页,看看问题是否解决。 3. 代理设置: 如果你使用了代理服务器,尝试禁用代理并直接连接到互联网,然后检查问题是否仍然存在。 4. 网站服务器问题: `net::ERR_CONNECTION_RESET` 错误也可
10291 0
解决OpenSSL SSL_read: Connection was reset, errno 10054
解决OpenSSL SSL_read: Connection was reset, errno 10054
1033 0
|
Python
ConnectionResetError: [Errno 104] Connection reset by peer
ConnectionResetError: [Errno 104] Connection reset by peer
608 0
|
Linux
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
643 0
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
|
网络协议 Java
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
694 0
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
|
网络安全
OpenSSL SSL_read: Connection was reset, errno 10054
OpenSSL SSL_read: Connection was reset, errno 10054 问题处理
 OpenSSL SSL_read: Connection was reset, errno 10054