Socket Comm Followup - Timing Out
Mark Wieder
mwieder at ahsoftware.net
Sat Apr 16 01:45:25 EDT 2005
Ken-
Friday, April 15, 2005, 9:24:13 PM, you wrote:
KR> OK, I have everything working fine now, with a timeout question:
KR> After one app finishes talking to the other, after a couple of seconds both
KR> apps register a socketTimeout... however if I come back and send data from
KR> either app, it is received properly, so should I be concerned about the
KR> timeout?
If your socket is still open and expecting more chars to come in then
you *will* get a timeout. If you've gotten your end-of-message char
then you shouldn't get a timeout. If you're not "reading until" a
delimiter char then you will probably be experiencing timeouts. I tend
to do something like (off the top of my head, not tested at all)
open socket lSock with message "SocketOpened"
on "SocketOpened"
-- prime the socket for the first line
read from socket lSock until cr with message "GotOneLine"
end "SocketOpened"
on GotOneLine
-- handle parsing your buffer here --
-- then prime the socket for more reads
read from socket lSock until cr with message "GotOneLine"
end GotOneLine
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list