A message for data waiting at a socket?

Dar Scott dsc at swcp.com
Fri Jan 2 22:14:19 EST 2004


On Friday, January 2, 2004, at 07:43 PM, Doug Lerner wrote:

> I am currently polling an open socket to check for data, or checking 
> for
> data immediately after writing to the socket (to check for replies to
> messages I send).
>
> But is there a message-driven way of doing this? Like if data is 
> waiting at
> a socket (data pushed from a server) having it trigger a message, like
> socketDataWaiting, or something like that?

Yes.

Use the "with message" option with the "read for socket" command.

You specify the name of the handler.  It is called with the socket ID 
and with the data in the buffer.  (You do not look in "it".)

You will need to arrange for multiple reads if needed.

Dar Scott



More information about the use-livecode mailing list