Timeout Option (General questions)
Hello,
Not sure if you have this feature, however I am looking for a Timeout option that can be used, but does not disconnect the session.
In my code, I perform a send command and wait for data (unknnown size) after 2 seconds of not receiving data, I would like to check my receive buffer to see if there is enough data for me to process. If not, I'll update my screen telling the user to wait, then wait for more data.
Thanks!
Barry
Re: Timeout Option
Barry,
You have a global timeout Property which has effect on the component. If you set this the component will disconnect after a certain period of inactivity has passed.
If you use WaitFor or Execute methods, then you can set the timeouts for those methods specfically. This allows you to still check what was received without timeouting.
Regards,
Damba
Re: Timeout Option
Thanks, this is looking more promising. I am using a VBScripting type environment (winbatch) so I cannot wait for events so I will be setting Blocking to true.
In my old code I execute the following:
Loop
Get from the receive buffer (timeout after 2 seconds)
Append receive buffer onto a 'global string'
If I see the words 'Next Page' send an F7 and loop back to the top
If I see the words 'Invalid command' send F1 and leave route
If I see the words 'Not supported' send F1 and leave route
If I see the words 'Command:' leave route
Display some stuff on screen
return to top
Can you give me a sample on how this might look?
Thanks!
Barry
Re: Timeout Option
Barry,
Something like this written in VBS should loop as long as there is data to receive:
a = something
While a <> ' iow while connected
a =
a = telnet.Receive
If a <> Then
resp = resp + a
Wscript.Echo resp
End If
Wend
As for other, you would have to parse the received contents, and decide what to do.
Unfortunately, I'm not familiar with WinBatch, and although it's similiar to VBS, I can't figure out how to use Events (VBS can, but with limited options).
Regards,
Damba
Re: Timeout Option
I'll check into the execute command as it looks like it will keep receiving data as I loop through the rest of the code.
THe problem isn't that I can't figure out how to receive, it's that by the time I get back to the top of the receive loop, the data that came in while it was waiting is now gone.
Just a couple of these issues to resolve, and I will be buying shortly!
Thanks
Barry
Re: Timeout Option
Barry,
Could you perhaps write the same in vbs? That way i could check why that occurs?
Regards,
Damba
Re: Timeout Option
I'll try and write something up tonight.
In the short term, I can send you my winbtach code if you would like to see the loop I am talking about. It is a fairly straight forward programming language.
Thanks
Barry
Re: Timeout Option
Barry,
You can, but I really can't make any promises regarding WinBatch. I'm not familiar with the syntax and its vapabilities of it.
Even making the application ignore the error and proceed with the code took me quite some time to figure out.
That's why I'd really appreciate it if you could do the coding in VBS.
If you are sending anything, you can send it to techsupport@weonlydo.com
Regards,
Damba
Re: Timeout Option
Hello,
Just wanted to say thanks for your excellent support! We will be buying a copy shortly, as it works great with Winbatch! (Just a bit of a learning curve)
Thanks
Barry