socketTimeout on subsequent send: how to?
Posted: Sun Feb 05, 2023 10:43 am
My client script, when a write to socket occurs, set a flag var "sWaitingForDataIn" to true (within the callBackMessage).
When receiving an answer from the server, it set the flag to false (the server always responds unless something happened or was busy, or else).
My socketTimeout script is something like this:
I always thought, for some reason, that any new write or read would replace the pending messages to the socketTimeout code, but apparently it is not true.
I mean, it looks to me that if I do 2 write to socket in a row with the same message, the "on socketTimeout" will receive, after the socketTimeoutInterval, 2 calls. If for a glitch the first one wasn't answered by the server (busy?), while the second try was, the socketTimout will still report the connection problem.
How can I avoid this?
Thanks
When receiving an answer from the server, it set the flag to false (the server always responds unless something happened or was busy, or else).
My socketTimeout script is something like this:
Code: Select all
on socketTimeout theID
if sWaitingForDataIn then
answer "Not responding. Want to stop? with "stop" OR "Keep on"
if it is "stop then
close socket theID
end if
end if
end socketTimeout
I mean, it looks to me that if I do 2 write to socket in a row with the same message, the "on socketTimeout" will receive, after the socketTimeoutInterval, 2 calls. If for a glitch the first one wasn't answered by the server (busy?), while the second try was, the socketTimout will still report the connection problem.
How can I avoid this?
Thanks