Problem with "read from socket"

Dar Scott dsc at swcp.com
Mon Jun 28 14:42:30 EDT 2004


On Jun 28, 2004, at 2:24 PM, maxence.bernard at ensi-bourges.fr wrote:

>> Your script is waiting for two bytes.
>
> So, is there a way to stop this waiting, otherwise my application 
> doesn't
> continue. How could I interrupt the "read from socket" instruction with
> the socketTimeout message ?

First, I need to say that I rarely use socket I/O without "with 
message", so I may be off here.

One way is to switch to the "with message" style, which can be wordy 
and breaks up your logic and thus can be awkward.  Even so, I recommend 
this.

The other method is to use "until empty" which will give you whatever 
is in the buffer and will return immediately.  I mentioned that in mail 
I just sent.

(One might guess it will return empty every time since it will match 
empty at the start of the buffer, but that is not the case.  One might 
guess that it will wait until the other end closes since empty is said 
to be equivalent to eof, but that is not the case either.)

Dar Scott



More information about the use-livecode mailing list