RE: 4D Client as Web Server - How to monitor

2017-10-04 Thread Randy Engle via 4D_Tech
Hi John,

Thanks for info.

Yes, something like this seems the best approach

Randy Engle, Director
XC2 Software LLC – XC2LIVE!

-Original Message-
From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of John Baughman 
via 4D_Tech
Sent: Wednesday, October 4, 2017 3:28 PM
To: 4D iNug Technical <4d_tech@lists.4d.com>
Cc: John Baughman 
Subject: Re: 4D Client as Web Server - How to monitor

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 s

Re: 4D Client as Web Server - How to monitor

2017-10-04 Thread John Baughman via 4D_Tech
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
> 
> 
> 

Re: 4D Client as Web Server - How to monitor

2017-10-04 Thread Chuck Miller via 4D_Tech
Couldn’t you launch a server process and look for web server running on a 
client? I don’t use web server so don’t know if a name or what name is there. 
but if it is you can find out if running already

Additionally I believe execute on client does exist. Not sure but you could 
launch a server process and execute on client to see

Hope this helps 
Regards
Chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

> On Oct 4, 2017, at 2:41 PM, 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
> **

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

RE: 4D Client as Web Server - How to monitor

2017-10-04 Thread Randy Engle via 4D_Tech
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
**