How to mimic telnet session
Dar Scott
dsc at swcp.com
Mon Dec 29 15:13:10 EST 2003
On Monday, December 29, 2003, at 12:45 PM, RGould8 at aol.com wrote:
> Solved - - I think - - - for some reason, I just had to put a couple
> more
> "wait 3 seconds" statements between the opening of the socket, and the
> writing
> and the reading of the socket data. I seem to be getting data now.
> I'll
> have to keep tweaking the times and see which wait statements are
> really needed.
Great!
If you need to get a quick report and then close, you might want to
forget about the 'with message' parts and do it all in a function.
Your app will freeze during this function, though. You might want to
consider setting the timeout and then using 'until numToChar(13)' or
something similar.
If you need other things to keep running, then you might want to use
'with message'. In that case, you will want to have a handler to get
things started (open). The open callback would do the write. The
write callback would do the read until some char (or start a cycle of
'read until empty' until some time has past or all data received). The
read callback would process the response and then do the close.
A compromise would be to do the first but use 'with messages' in the
wait. You may need to avoid repeated nested queries.
Dar Scott
More information about the use-livecode
mailing list