maintain multiple socket connections while putting the recv through a single handler in python -


i have function returns host specific site. , using these 2 functions

def connect(self, rooms):     print('')     = [x x in rooms]     x in i:         self.room_connect(x)     running = true                 while running:         self.event_data()`  def room_connect(self, rooms):     host = getserver(rooms)     sock = socket.socket(socket.af_inet, socket.sock_stream)     sock.connect((host, 443))      sock.send(self.room_auth(rooms).encode())     self.sockets = sock     print(self.sockets)     print('connected '+ rooms)     self.postbyte = true  

i able connect different socket each host. problem is, need maintain connection each socket connects to. in end, last socket created in loop maintained. socket recv data socket passed in handler parse info. asking how keep connection each of sockets created in loop going while passing recv info in handler. handler event_data() , in event_data function data parse defined data = self.sockets.recv(1024). problem last socket loop left on handled.

put in dictionary. can in future whatever want.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -