If you have an existing program that reads from stdin and writes to stdout - and you want to control / monitor it from another app - then it'd be natural to just use 'read from process'. Or if you have a program that you don't own / develop you might have to use 'read from process'.

In general, using sockets is much more flexible and (once you've got over the initial hurdle of building socket communications once or twice) very simple - start with the lesson Phil pointed to, look at Chatrev, etc.

'read from process' has many limitations - in particular you need to "poll" for input, using the 'read from process... in x msecs" form. If you use sockets then you can have the programs operate asynchronously, and have a handler that is called when data is ready for you. Or you can communicate with multiple other apps. Or move one of the apps to another machine (with some care over security). Or .... almost anything.

-- Alex.



On 09/11/2011 07:38, Pete wrote:
Very useful lesson.  I guess I'm still interested in the
differences/pros/cons of using sockets versus open process/read from
process/write to process LC commands (assuming both processes are LC).  Do
those commands use sockets under the covers?
Pete
Molly's Revenge<http://www.mollysrevenge.com>




On Tue, Nov 8, 2011 at 9:27 PM, Phil Davis

There is a nice intro to LC sockets here:
http://lessons.runrev.com/s/**lessons/m/4071/l/12924-How-to-**
communicate-with-other-**applications-using-sockets<http://lessons.runrev.com/s/lessons/m/4071/l/12924-How-to-communicate-with-other-applications-using-sockets>

For inter-app communication, both apps are client AND server.
Phil



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to