Changeset 26 for rc/puzzlebox_brainstorms_server.py
- Timestamp:
- 02/03/10 23:05:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rc/puzzlebox_brainstorms_server.py
r25 r26 11 11 # For more information please refer to http://www.gnu.org/copyleft/gpl.htm 12 12 # 13 # Last Update: 2010.02.0 213 # Last Update: 2010.02.03 14 14 # 15 15 ##################################################################### … … 30 30 DEBUG = 1 31 31 32 SERVER_ HOST = configuration.SERVER_HOST32 SERVER_INTERFACE = configuration.SERVER_INTERFACE 33 33 SERVER_PORT = configuration.SERVER_PORT 34 34 … … 41 41 def __init__(self, log, DEBUG=DEBUG): 42 42 43 self.protocol = puzzlebox_brainstorms_server_protocol44 45 43 self.log = log 46 44 self.DEBUG = DEBUG 47 45 48 self. registry = {}46 self.protocol = puzzlebox_brainstorms_server_protocol 49 47 50 48 … … 58 56 59 57 if self.DEBUG: 60 print '--> [Server] %s command received' % command58 print '--> [Server] %s' % response 61 59 62 command = 'python puzzlebox_brainstorms_rc.py --command=%s' % command 63 os.system(command) 60 61 command_line = 'python puzzlebox_brainstorms_rc.py --command=%s' % command 62 63 os.system(command_line) 64 64 65 65 … … 150 150 151 151 # Collect default settings and command line parameters 152 server_ host = SERVER_HOST152 server_interface = SERVER_INTERFACE 153 153 server_port = SERVER_PORT 154 154 155 155 for each in sys.argv: 156 156 157 if each.startswith("-- host="):158 server_ host = each[ len("--host="): ]157 if each.startswith("--interface="): 158 server_interface = each[ len("--interface="): ] 159 159 if each.startswith("--port="): 160 160 server_port = each[ len("--port="): ] 161 161 162 162 163 mcp = puzzlebox_brainstorms_server(log, DEBUG) 164 reactor.listenTCP(port=server_port, factory=mcp, interface=server_host) 163 server = puzzlebox_brainstorms_server(log, DEBUG=DEBUG) 164 165 if DEBUG: 166 print "--> [Server] Initializing server on %s:%i" % \ 167 (server_interface, server_port) 168 169 reactor.listenTCP(interface=server_interface, port=server_port, factory=server) 170 165 171 reactor.run() 166 172
Note: See TracChangeset
for help on using the changeset viewer.