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

相关文章
|
2月前
|
网络安全
client_loop: send disconnect: Connection reset by peerB/s4-5
client_loop: send disconnect: Connection reset by peerB/s4-5
|
4月前
|
监控 网络安全
Connection reset by peer的原因
Connection reset by peer的原因
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
|
6月前
|
Go 开发工具 git
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
1891 0
|
5月前
|
Linux 数据安全/隐私保护
Could not connect to ‘121.37.92.110‘ (port 22): Connection failed.
Could not connect to ‘121.37.92.110‘ (port 22): Connection failed.
|
6月前
|
网络安全 开发工具 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
767 0
解决OpenSSL SSL_read: Connection was reset, errno 10054
解决OpenSSL SSL_read: Connection was reset, errno 10054
873 0
|
Python
ConnectionResetError: [Errno 104] Connection reset by peer
ConnectionResetError: [Errno 104] Connection reset by peer
583 0
|
网络协议 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
662 0
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer