At first I thought, hey an excellent place for Call Worker or Call Form. Then 
after thinking it though decided that would be more complicated then needed.

 If it were me, I would put an object field in a table, in my case my constants 
table, and pass the status in that field. Using this field there would be many 
options to monitoring the status of the web server from any 4D client or 4D  
server at any time. The field can be updated by the web server client when 
starting and shutting down itself and/or the web server, making it’s status 
known to all clients and 4D server in real time without any communications. If, 
as in your case, you need to periodically check to see if the Web Server is in 
fact still running or has crashed, you can use EXECUTE ON CLIENT…

------------------
//Web ServerClient On Startup
        REGISTER CLIENT(“WebServerClient”)
        Start Web Server
        C_OBJECT($oWebServerStatus)
        OB SET($oWebServerStatus;”Status”;”Running”;……more info aa needed)
        READ WRITE([Constants])
        ALL RECORDS([Constants]) //only 1 record in constants table
        [Constants]oWebServerStatus:= $oWebServerStatus
        SAVE RECORD([Constants])
        UNLOAD RECORD([Constants])
        READ ONLY([Constants])

//Client doing the checking
        READ WRITE([Constants])
        ALL RECORDS([Constants]) //only 1 record in constants table
        OB SET([Constants]oWebServerStatus;”Status”;”Testing”)
        SAVE RECORD([Constants])
        UNLOAD RECORD([Constants])
        READ ONLY([Constants])
        EXECUTE ON CLIENT(“WebServerClient”;”WebServerStatusMethod”)

        ALL RECORDS([Constants]) //only 1 record in constants table
        While (OB GET([Constants]oWebServerStatus;”Status”)=“Testing”)
                Pause process …. ?maybe not needed?
                All records([Constants]) //only one record in the constants 
table. Need this to reflect any changes made by the WebServer Client

        End While

        If (OB GET([Constants]oWebServerStatus;”Status”)=“Running”)
                //Do whatever if running

        Else
                //Do whatever if not running

        End If

//Web ServerClient WebServerStatusMethod
        ALL RECORDS([Constants]) //only 1 record in constants table
        Case of
                :(OB GET([Constants]oWebServerStatus;”Status”)=“Testing”)
                        C_OBJECT($oWebServerStatus)
                        Test web server
                        If (web server is running)
                                OB 
SET($oWebServerStatus;”Status”;”Running”;……more info aa needed)
                                
                        else
                                OB SET($oWebServerStatus;”Status”;”Not 
Running”;……more info aa needed)

                        End If
                        READ WRITE([Constants])
                        ALL RECORDS([Constants]) //only 1 record in constants 
table
                        [Constants]oWebServerStatus:= $oWebServerStatus
                        SAVE RECORD([Constants])
                        UNLOAD RECORD([Constants])
                        READ ONLY([Constants]

        End Case

———————



John
> On Oct 4, 2017, at 8:41 AM, Randy Engle via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Those of you who have 4D Client acting as web server:
> 
> I've got 4D client working great as a web server.
> 
> Now I like to "know" that the web server is running from another client.
> 
> I'd love to have the same functionality as the Execute on Server attribute
>       But for a specific client
>       Not available, that I know of
> 
> I've got a few options that I can think of:
> 
> I'm not enthused about any of them
> I'd like to think there's a much easier way.
> Hopefully I'm just being dense.
> 
> 1.    Get the "Registered Name" of the Web server client
>       Send an EXECUTE ON CLIENT asking Web client if server is running
>       Send back an EXECUTE ON CLIENT to the "calling" Client with the results
>       (would require a "Delay" until received info)
> 
> 2.    Get the "Registered Name" of the Web server client
>       Send an EXECUTE ON CLIENT asking Web client if server is running
>       Have the client send an object with the web server info using SET 
> PROCESS VARIABLE to the Server
>       (or EXECUTE ON SERVER)
>       Have the original calling client GET PROCESS VARIABLE from server
>       (would require a "Delay" until received info)
> 
> 3.    Have the Web Server client continually loop (every minute or so)
>       And have the client send an object with the web server info using SET 
> PROCESS VARIABLE to the Server
>       (or EXECUTE ON SERVER)
>       Have the original calling client GET PROCESS VARIABLE from server
> 
> 4.    Do an HTTP Get on the Web Server Client
>       NOTE:
>       OK if the web server is running
>       If web server not running, there is a long delay before HTTP get 
> returns with the status code.
>       So, not an option
> 
> 
> Any other ideas from the 4D Brainiacs?
> 
> Gracious Thanks!
> 
> Randy Engle, Director
> XC2 Software LLC – XC2LIVE!
> 
> 
> 
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to