Page 1 of 1

Use of It in concurrent processes

Posted: Tue Oct 20, 2015 1:45 pm
by kolia
Hello,

I have a routine that reads a socket every x seconds. Each read statement put the result in the It variable. Beside that there are user interactions that may lead to using the read socket command as well. In that scenario I have a "chance" to get a value in the It variable that is not the one that is expected. Is there a way to have the read command returning the result in another variable?
Thank you

Re: Use of It in concurrent processes

Posted: Tue Oct 20, 2015 4:19 pm
by Klaus
Hi kolia,
kolia wrote:Is there a way to have the read command returning the result in another variable?
no!

But you should put IT into another variable IMMEDIATELY after getting IT!
That is the only way to prevent this kind of inconvenience.


Best

Klaus

Re: Use of It in concurrent processes

Posted: Tue Oct 20, 2015 4:41 pm
by kolia
This indeed what I do. But I found a trick: I use the peerAddress of host:port command that returns "not an open socket" in case the device is free.

Re: Use of It in concurrent processes

Posted: Tue Oct 20, 2015 5:37 pm
by dunbarx
Hi,

Glad you found a workaround.

Now do what Klaus said. Always, always put the value of "it", however obtained (answer dialog, read..., convert, whatever) into another variable right away. You will be glad you did.

Craig Newman