×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    47

    Force server restart

    Hi,

    I was wondering if it possible to force a restart of the mobile web server from python code?

    I guess starting a server instance with e32.start_exe() is probably not much of a problem, but how to kill the current running thread? And preferably there would some better solution.

    If anyone have any thoughts please let me know.

    best regards,
    Magnus

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Force server restart

    Hi,

    Quote Originally Posted by maggias View Post
    I was wondering if it possible to force a restart of the mobile web server from python code?
    What exactly do mean by restarting? Forcing Apache to release all resources and close all connections, and reread the config file and do a logical restart, or causing the process to exist and restart?

    I guess starting a server instance with e32.start_exe() is probably not much of a problem,
    In this case it would be, because Apache runs in one (or more) separate threads inside a Symbian server. That is, merely starting the process is not enough, you need to connect to it and instruct it to start Apache.

    but how to kill the current running thread? And preferably there would some better solution.
    Assuming you want to tweak httpd.conf from a request handler and then cause Apache to take those settings into use, one approach would be to have Apache do a logical restart. And the best way for that would be to create a Python extension for RHttpd.h or CHttpd. That would allow you to call restart from the request handler, which would have the effect of causing Apache to do a logical restart after the current request has been processed completely.

    Doing such a Python extension has been on my todo-list for ages, but I just haven't gotten around doing it.

    Johan

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    47

    Re: Force server restart

    Hi,

    Basically I want the same effect as when I "stop server" / "start server" from the Web Server GUI.

    What I am really interested in though is to clear the memory.

    When I have a python script implementing a object and then update the script I have noticed that the "old" object is executed until the server has been restarted. If the script has been run at least once before updating the .py file.

    So it seems like python compiles the object and stores it in memory after first execution, which is great in most situations, but not when updating the code and stuff like that.

    But maybe this would be solved by simply copying .pyc files to the device instead of .py source files, I haven't tried that.

    Otherwise it seems to me that your last two paragraphs describe the appropriate solution.

Similar Threads

  1. N95 / E70 Bluetooth Server
    By lskmao in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-09-15, 15:55
  2. TCP server packet receiving problem
    By raj_rr7 in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2007-07-12, 12:24
  3. Cannot to receive data from server...
    By ramis55 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-05-09, 13:46
  4. J2ME and Server communication
    By johanmeyer in forum Mobile Java Networking & Messaging & Security
    Replies: 7
    Last Post: 2004-07-07, 00:26
  5. Server not being invoked directly. Only a particular file being invoked
    By Nokia_Archived in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2002-05-21, 14:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •