Skip to content

Commit d73b788

Browse files
gijzelaerrclaude
andcommitted
Mark routing support as experimental
Add experimental warnings to connect_routed, set_routing, and documentation so users know the API may change. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8a6309b commit d73b788

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

doc/connecting.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,32 @@ Using a Non-Standard Port
122122
client = Client()
123123
client.connect("192.168.1.10", 0, 1, tcp_port=1102)
124124
125+
Routing (Multi-Subnet Access)
126+
------------------------------
127+
128+
.. warning::
129+
130+
Routing support is experimental and may change in future versions.
131+
132+
When the target PLC sits on a different subnet behind a gateway PLC, use
133+
``connect_routed`` to let the gateway forward the connection:
134+
135+
.. code-block:: python
136+
137+
import snap7
138+
139+
client = snap7.Client()
140+
client.connect_routed(
141+
host="192.168.1.1", # gateway PLC address
142+
router_rack=0, # gateway rack
143+
router_slot=2, # gateway slot
144+
subnet=0x0001, # target subnet ID
145+
dest_rack=0, # target PLC rack
146+
dest_slot=3, # target PLC slot
147+
)
148+
data = client.db_read(1, 0, 4)
149+
client.disconnect()
150+
125151
Legacy ``snap7`` Package
126152
-------------------------
127153

snap7/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ def connect_routed(
422422
*dest_rack*, *dest_slot*) through S7 routing parameters embedded in
423423
the COTP Connection Request.
424424
425+
.. warning:: This method is experimental and may change in future versions.
426+
425427
Args:
426428
host: IP address of the routing gateway PLC
427429
router_rack: Rack number of the gateway PLC

snap7/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def set_routing(self, subnet_id: int, dest_rack: int, dest_slot: int) -> None:
110110
additional parameters that instruct the gateway PLC to forward
111111
the connection to a target PLC on another subnet.
112112
113+
.. warning:: This method is experimental and may change in future versions.
114+
113115
Args:
114116
subnet_id: Subnet ID of the target network (2 bytes)
115117
dest_rack: Rack number of the destination PLC

0 commit comments

Comments
 (0)