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
Use non privileged tcp port in examples #109
Use non privileged tcp port in examples #109
Conversation
Thanks for you suggestion! I don't like to change to default port of the client, as Modbus server are usually listening to port 502. But I realize it's not very friendly to just let the server crash. Therefore I suggest 2 thinks to make the server more user friendly, but keeping default port at 502.
|
Sounds good! |
Please update the README.md as well. I expect that a significant amount of users just copy the code from the README.md. Although I don't have proof to back it up |
65454a6
to
b7077cf
Compare
b7077cf
to
792d785
Compare
I think it should be ready to review now |
# Response depends on Modbus function code. This particular returns the | ||
# amount of coils written, in this case it is. | ||
response = tcp.send_message(message, sock) | ||
with create_connection((host, port)) as sock: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL that a socket.Socket
object can be used as a context manager. Thanks!
It would be nice if the examples work out of the box without the user needing access to tcp port 502.
I propose using
15020
in this PR but I could change to something else if you prefer