Commit b6e4437
Mark connection as disconnected on TCP errors
Set self.connected = False in send_data(), receive_data(), and
_recv_exact() when TCP errors or timeouts occur. This ensures
get_connected() returns False after a network failure, preventing
stale data from being returned on subsequent operations.
After a TCP error, users must reconnect to the PLC, which is the
correct behavior per the original snap7 documentation.
Fixes #70
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 68af88d commit b6e4437
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| |||
373 | 376 | | |
374 | 377 | | |
375 | 378 | | |
| 379 | + | |
376 | 380 | | |
377 | 381 | | |
378 | 382 | | |
| 383 | + | |
379 | 384 | | |
380 | 385 | | |
| 386 | + | |
381 | 387 | | |
382 | 388 | | |
383 | 389 | | |
| |||
0 commit comments