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.
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
15020in this PR but I could change to something else if you prefer