-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConnectionResetError: [Errno 104] Connection reset by peer #81
Comments
Hello @unidev10. You seem to want to connect to My guess is that you need to replace sock.connect(('192.168.1.1', PORT)) |
Hi @OrangeTux, yes I have mentioned the required ip address and the port number in my actual code. It is just for the question, I have replaced the ip address with |
Super! I'll close the issue now. Feel free to reopen if needed. |
Hi @OrangeTux, there has been a slight misunderstanding. In my original code, I have written |
Are you sure a modbus server is running on that IP-address? If so, there's probably something in your network filtering out your connection request, like a firewall of some kind. The error you get is a more generic error from Python not being able to open a socket. Try to look up I don't think this is a problem with uModbus, as uModbus doesn't do any connection handling, that's all done by the |
After
tcp.read_coils()
function, when I run the commandtcp.send_message()
I get the error -ConnectionResetError: [Errno 104] Connection reset by peer
.How can this be solved?
Below is my code attached
import socket
from umodbus import conf
from umodbus.client import tcp
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('HOST', PORT))
m2=tcp.read_coils(slave_id=1, starting_address=8193, quantity=1)
response = tcp.send_message(m2, sock)
The text was updated successfully, but these errors were encountered: