NetTalk Central

Author Topic: Close web server remotely (EVENT:CloseDown)  (Read 2748 times)

vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Close web server remotely (EVENT:CloseDown)
« on: October 22, 2008, 02:56:54 PM »
When I create a page that sends a POST(EVENT:CloseDown,,MyMasterThread), it results in a GPF.

One wrinkle is that when the master thread receives the CloseDown request, it posts that same request to all other threads in the application.

What is the best way to provide the end user with a way to close the web server application remotely?

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Close web server remotely (EVENT:CloseDown)
« Reply #1 on: October 22, 2008, 10:29:58 PM »
Hi Vince, Could you instead check a box that saves a true value in an INI or data file, and use a timer on the frame to change the value to false, then shut down?
Mike Grigsby
Credify Systems
Central Oregon, USA

vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Re: Close web server remotely (EVENT:CloseDown)
« Reply #2 on: October 23, 2008, 07:13:34 AM »
It has to be as close to real-time as possible, because I'm also going to use this to restart the application when the user switches it to/from service mode. 

The frustrating part is that occasionally it won't GPF, so I never know if I've fixed it, or just gotten lucky. :-s

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Close web server remotely (EVENT:CloseDown)
« Reply #3 on: October 23, 2008, 08:09:54 AM »
Hi Vince,
one way i have done this is use a Global variable, set from your webpage
then  examine it in Webserver's thiswindow.takeevent Procedure
right after the parent call i have something like:
 
Code: [Select]
if RUN:ServerRequests = 1   
   post (event:closewindow)
end   


or i'll use a an event:accepted on a button, and do what i need in there.

More recently my signal is thru a Nettalk Simple object so i then can do a selfservice.Closedown()  ...  even from an external control program.

poul

vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Re: Close web server remotely (EVENT:CloseDown)
« Reply #4 on: October 23, 2008, 01:18:22 PM »
It's sort of the reverse of your situation; I was already posting the event.

I had a GLO:IsClosing variable, which was used to control how log entries were written out in a special worker thread, and I've now expanding its usage.

Adding code to the web server thread that prevents it from starting more web handler threads when the program is closing down seems to have solved the problem.
« Last Edit: October 23, 2008, 01:20:05 PM by vsorensen »