[Tutor] Stopping a webservice
alan.gauld at btinternet.com
Thu Oct 21 16:39:37 CEST 2010
Forwarding to list....
"Timo" <timomlists at gmail.com> wrote
>>The plans are to run this on my webserver. I created a webpage with a start
>>>and stop button, the starting works great. But how could I remember this
>>>class to call "class.shutdown = True" any given time when I press the stop
There arec several ways but one would be to pass the connection
>>object ID as a cookie and then when Quiting usend the cookie data to the
>>server which ises it to referenbce the connection object - a dictionary
>>might be useful here...
Could you give me a bit more information please?
On my webpage, when I press start, the following is run:
def start_server(name, port):
connection = Connection(name, port)
So when I close this page, I loose "connection". How could I put this in a
dictionary or cookie for later reference?
I'm not sure I understand your issue?
What part of 'put this in a dictionary' do you not understand?
mydict[(port,name)] = connection
would be one way...
And when you say on your web page the following is run...
Do you mean the function is executed on the browser? Or do you mean you
submit some information to the server which executes the code?
If so that begs the question which web framework you are using?
Somehow you need to create a mechanism for retrieving the connection.
That retrieval must be based on some kind of name/key that can be stored
or recreated by the web client. A dictionary is only one possibility.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor