socketserver

socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

限于喜欢 提交于 2019-11-26 15:24:04
I'm trying to create a custom TCP stack using Python 2.6.5 on Windows 7 to serve valid http page requests on port 80 locally. But, I've run into a snag with what seems like Windows 7 tightened up security. This code worked on Vista. Here's my sample code: import SocketServer import struct class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): headerText = """HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-Type: text/html Content-Length: 1354""" bodyText = "<html><body>some page</body></html>" self.request.send(headerText + "\n" + bodyText) if __name__ == "__main__":

socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

冷暖自知 提交于 2019-11-26 05:58:31
问题 I\'m trying to create a custom TCP stack using Python 2.6.5 on Windows 7 to serve valid http page requests on port 80 locally. But, I\'ve run into a snag with what seems like Windows 7 tightened up security. This code worked on Vista. Here\'s my sample code: import SocketServer import struct class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): headerText = \"\"\"HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-Type: text/html Content-Length: 1354\"\"\" bodyText =