Can a Rev cgi "accept connections"?
Nicolas Cueto
niconiko at gmail.com
Mon Jan 18 03:54:20 EST 2010
Why do I ask?
Cause, after studying about sockets using Rev's "chat server/client" sample
stack (thank you to Bill Vlahos for pointing it out), I'm now trying to get
a Rev cgi script to act as the server (the script will be in my on-rev
Rev-cgi folder).
Unfortunately, what works locally isn't at all on the web.
If it helps, here's the Rev cgi server-script and a snippet of the client
stack:
/////////////// Rev.cgi server script ////////////////////////////////
#!MyRevEngine -ui
on startup
accept connections on port 1987 with message chatConnected
end startup
on chatConnected s -- s contains address and port of connecting computer
read from socket s for 1 line
put line 1 of it into tSocket
put "Hello world" && tSocket into message
write message to socket tSocket
close socket tSocket
end chatConnected
/////////////////// client stack ///////////////////////////
on mouseUp
open socket to "myurl.com/cgi-bin/server.cgi:1987" with message
"chatConnected"
end mouseUp
on chatConnected s
put s into lChatSocket
read from socket s with message chatReceived
end chatConnected
on chatReceived s,data
put data & return after field "responses"
read from socket s with message chatReceived
end chatReceived
//////////////////////////////////////////////////////////////////////////////
Apologies if I'm asking for excessive hand-holding.
Thanks.
--
Nicolas Cueto
More information about the use-livecode
mailing list