From: Kevin A. <ka...@us...> - 2004-11-03 19:51:12
|
Update of /cvsroot/pythoncard/PythonCard/samples/webserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24431/webserver Modified Files: webserver.py Log Message: added try/except to deal with failure on DNS lookup Index: webserver.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/webserver/webserver.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** webserver.py 28 Jul 2004 17:05:54 -0000 1.25 --- webserver.py 3 Nov 2004 19:50:58 -0000 1.26 *************** *** 82,86 **** self.validIPList = ['127.0.0.1'] # add host IP address that this server is running on ! self.validIPList.append(socket.gethostbyname(socket.gethostname())) self.allowAny = 0 HTTPServer.__init__(self, server_address, RequestHandlerClass) --- 82,93 ---- self.validIPList = ['127.0.0.1'] # add host IP address that this server is running on ! # this will fail for address spaces like 10.0.0.x, 192.168.0.x ! # etc., so what is the appropriate way to add those? ! # I get errors like ! # socket.gaierror: (7, 'No address associated with nodename') ! try: ! self.validIPList.append(socket.gethostbyname(socket.gethostname())) ! except: ! pass self.allowAny = 0 HTTPServer.__init__(self, server_address, RequestHandlerClass) |