Daniel Crespo wrote: > Hello to all, > > I have to build a server app without GUI. This app must be an xml-rpc > server, so it has to be up all the time. I would control it through the > xml-rpc port from a web interface using php, sending parameters to > defined xml-rpc functions for running certain processes, like viewing > current connections, restart it or shutting it down, for example. > > Actually, I have it implemented with wxPython. The GUI controls when > the xml-rpc server is running, so when I close the GUI, so does the > server and all the dependent threads. > > I want to do something like the MainLoop(), but without GUI. I can sit > down and build all this stuff, but I would like to know if someone had > passed through this. Any tips? > > Thanks > > Daniel here is complete example - some words in french note: this will open a dos box for std IO #********************************************************************************* # -*- encoding: iso-8859-1 -*- import os import SimpleXMLRPCServer import xmlrpclib
class mainServeur(object): """ going to be the servicing object""" def __init__(self): pass def testServeur(self): return "i am a server" monPort = 4089 # whatever server = SimpleXMLRPCServer.SimpleXMLRPCServer(("127.0.0.1", monPort)) def kill(): global quit quit = 1 return "i am a dying server" # Globales quit = 0 activeController= mainServeur() server.register_instance(activeController) server.register_function(kill) #Go into the main listener loop print "llistening on port ",monPort while not quit : server.handle_request() #********************************************************************************** -- http://mail.python.org/mailman/listinfo/python-list