Reading from Sockets

rgould8 at aol.com rgould8 at aol.com
Tue Apr 29 22:15:09 EDT 2008


If I have a webpage that has a link like this:

<a href="127.0.0.1:77">Talk to Rev</a>


and while that webpage in Safari has that link clicked, I'd like to have Revolution lurking in the background waiting for that click, can someone tell me what I'd need to add to this script?

on openCard
? open socket "127.0.0.1:77"
? read from socket "127.0.0.1:77" with message "gotdata"
end openCard


on gotdata
? answer "got data from the Safari webpage!"
? close socket "127.0.0.1:77"
end gotdata



I'm just a little confused about whether I need to _continually_ do the "read socket" in a timer-loop, or if I can give it an infinite timeout.
Right now, I don't get this to work at all, even when I click the link within 5 seconds, so I'm obviously missing something important.? 




 

-----Original Message-----
From: Bill Marriott <wjm at wjm.org>
To: use-revolution at lists.runrev.com
Sent: Tue, 29 Apr 2008 8:33 am
Subject: Re: way to listen to port 127.0.0.1










You're on the right track.

If what you really need to do is to communicate with Rev from your web page, 
you could set up Revolution as a very simple web server on a *different* 
port -- Safari will use port 80 by default -- and send it a command in the 
form of a URL or POST command. You don't want to have the two applications 
(Safari and Rev) stepping on each other, trying to use the same port.

Andre Garzia's RevOnRockets has a basic web server implementation, but I 
don't know if you'd even need that fully-featured of a solution.

http://www.andregarzia.com/RevOnRockets/

> So, that puts me to Plan B:
>
> Since this is a touch-screen kiosk environment and I have full-control 
> over the hardware/software, I'd like to just use "SAFT", which is software 
> that makes Safari run in full-screen mode, and then have a silent version 
> of Rev running in the background waiting for it's cue.? When it receives 
> the cue, it needs to print some data to a thermal-label printer attached 
> to the kiosk.
>
> I am was hoping that I could have a javascript on a web-page that passes 
> data to 127.0.0.1:80, and then have my Rev app ready to receive that data.
>
> I'm not suceeding, however, and I could use some assistance with the 
> scripting.?
>
> Something like:
>
> open socket "127.0.0.1:80"
> read from socket "127.0.0.1:80" with message "gotdata"
>
> and then on the web-page:
>
> a href="127.0.0.1:80">Click me to test sending a message to Revolution</a>



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



 




More information about the use-livecode mailing list