NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: vsorensen on October 22, 2008, 02:56:54 PM

Title: Close web server remotely (EVENT:CloseDown)
Post by: vsorensen 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?
Title: Re: Close web server remotely (EVENT:CloseDown)
Post by: Mike Grigsby 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?
Title: Re: Close web server remotely (EVENT:CloseDown)
Post by: vsorensen 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
Title: Re: Close web server remotely (EVENT:CloseDown)
Post by: Poul 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
Title: Re: Close web server remotely (EVENT:CloseDown)
Post by: vsorensen 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.