Skip to content

Commit

Permalink
Use non privileged tcp port in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagocoutinho committed Nov 7, 2020
1 parent 4fd98ba commit b6ab762
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Creating a Modbus TCP server is easy:
conf.SIGNED_VALUES = True
TCPServer.allow_reuse_address = True
app = get_server(TCPServer, ('localhost', 502), RequestHandler)
app = get_server(TCPServer, ('localhost', 15020), RequestHandler)
@app.route(slave_ids=[1], function_codes=[3, 4], addresses=list(range(0, 10)))
Expand Down Expand Up @@ -91,7 +91,7 @@ Doing a Modbus request requires even less code:
conf.SIGNED_VALUES = True
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 502))
sock.connect(('localhost', 15020))
# Returns a message or Application Data Unit (ADU) specific for doing
# Modbus TCP/IP.
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples/simple_tcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
conf.SIGNED_VALUES = True

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 502))
sock.connect(('localhost', 15020))

# Returns a message or Application Data Unit (ADU) specific for doing
# Modbus TCP/IP.
Expand Down
3 changes: 2 additions & 1 deletion scripts/examples/simple_tcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
conf.SIGNED_VALUES = True

TCPServer.allow_reuse_address = True
app = get_server(TCPServer, ('localhost', 502), RequestHandler)
app = get_server(TCPServer, ('localhost', 15020), RequestHandler)


# Read Coils and Read Discrete Inputs
@app.route(slave_ids=[1], function_codes=[1, 2], addresses=list(range(0, 10)))
def read_data_store(slave_id, function_code, address):
"""" Return value of address. """
Expand Down

0 comments on commit b6ab762

Please sign in to comment.