Can a Rev cgi "accept connections"?

Jim Ault jimaultwins at yahoo.com
Mon Jan 18 06:00:09 EST 2010


> 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.
>

Wouldn't you have to use Fast CGI for that?

Normally a CGI script only runs as a single instance when called, and  
then immediately quits.  If called again, it relaunches, but is a  
separate instance with no common variables unless a programmer does  
something to create "session variables".

In PHP, the use of globals is a serious security hazard since these  
areas of memory can be hijacked by inventive bots and programmers and  
cause havoc, such as denial of service attacks and spambots.

Further, the customer of a hosting company does not get to change the  
firewall settings (TCP and UDP) so you would have to use the existing  
port configuration.

Locally, if you changed the httpd.conf file to have Apache listen at  
ports other than just port 80, then rebooted it, Apache could get  
packets on ports such as 1987.
A hosting company, even the one in Texas that is used by On-Rev,  
probably would not allow a request to reconfigure your account.  This  
is an area I know little about for General hosting, but I do have  
several Rev apps running in a Private data center where firewall  
requests are handled by the tech group and have to get approval.  I  
write connection software for the company that owns the data center,  
otherwise I would have no chance of submitting work orders to make  
changes.

I would suggest you contact the On-Rev hosting company and ask how  
they are setup to allow chat server programs to operate on their  
system.  It could be that cPanel has a tool for doing that on a port  
that is already configured.  If you are not familiar with cPanel (as I  
am not).

You should Google "cPanel chat server"
and do some reading to get to know exactly what you want, then  
hopefully it is possible.  It would be cool if it were easy, and then  
you could let us know a few details when you are up and running.



Jim Ault
Las Vegas


On Jan 18, 2010, at 12:54 AM, Nicolas Cueto wrote:

> 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.




More information about the use-livecode mailing list