Reputation: 73
Is even possible to start multiple TCP socket server using an list? Maybe a sample would be more useful
class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
#This is my handler. It works great for one server so not including it to save space
handler_object = MyHttpRequestHandler
my_servers = []
PORT = 8080
for dev in devices:
my_servers.append(socketserver.TCPServer(("", PORT), handler_object))
PORT += 1
for server in my_servers:
server.serve_forever()
So basically what I want to do is iterate through the my_servers
list and start each of the servers. IK there may be a chance of starting too many servers, but the function that populates devices
takes care of that.
Upvotes: 1
Views: 12