-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
how to recover from an intermittent TCP timeout exception #70
Comments
hm, interesting. To be honest, I don't know. python-snap7 is just a thin wrapper around the snap7 library, I think we need to ask the original snap7 author what the idea behind this is. Can you open an issue on the snap7 bugtracker, and keep this issue updated? |
Sure, I'll do that.
I did scour the python wrapper some and see that it does not implement
anything beyond the original snap7 library.
…On Mon, Feb 27, 2017 at 10:28 AM Gijs Molenaar ***@***.***> wrote:
hm, interesting. To be honest, I don't know. python-snap7 is just a thin
wrapper around the snap7 library, I think we need to ask the original snap7
author what the idea behind this is. Can you open an issue on the snap7
bugtracker, and keep this issue updated?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#70 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ7SAulnzpmocOD8KCi_gjZJAg_KygB4ks5rgxXHgaJpZM4MNcla>
.
|
See the discussion on sourceforge I duplicated the issue I was having with my python application by replicating it in C. Apparently there are certain types of error's, a TCP timeout being one of them, that require a re connection to the plc. Davide is very responsive. Big thanks for his support. |
ok great. So can we close this issue? |
Could you replicate the code to handle the error? I'm having hte same issue. |
We should add some connection checks / handle network errors properly.
|
Do you found a solution for this issue as I have a similar issue . Please advise ? |
Same here. I would like to implement something like a timeout that I can pass with the connect. My skills are limited, but what i have in mind is something like this: siemens_logo_plc.connect(logo_ip, TSAP_CLIENT, TSAP_SERVER, timeout) Currently, I wrap the connect in Try,Except. That is working, but not an elegant solution. |
What is the proper way to recover from a snap7 exception ISO : An error occurred during recv TCP : Connection timed out?
If I place a db_read() into a try/except clause to keep the application from aborting on TCP timeout, subsequent db_read() become out of sync. It seems somewhere the calls are queued. Probably in the native snap7 thread.
For example: If I have three locations I am reading from a PLC
3,260,4 contains value 100
3,272,4 contains value 200
1,104,4 contains value 300
-the first db_read(3,260,4) call successfully returns a value 100
-second db_read(3,272,4) call times out with TCP timeout exception
-third db_read(1,104,4) call will return value 200 (Not 300 like you would expect)
..
-a fourth call of db_read(3,260,4) will return the value from the third call above (300)
It seems the method calls get spooled into a queue and for every call that times out, the data returned will be delayed that many calls in the future.
Is there a way to throw away the buffer on a tcp timeout? Or is there some other philosophical approach I should be taking? It seems very dangerous to call a function with specific arguments and get the wrong data back. Thanks for any suggestions.
The text was updated successfully, but these errors were encountered: