Nov-24-2019, 07:17 PM
I am working on a GUI based chat program.
I am using someone else's server which has worked well for many people so I am assuming the problem is with my client's code.
When I run a single instance of the client it works perfectly, but if I run two instances of the client on the same computer the listener stops responding when the 2nd client logs in.
Though, the clients are no longer updating their histories after 'Dave' logs in.
Yet, the server continues to show that it is receiving the messages from both clients.
The network connection is working properly. It just locks up the list_box updating threads.
No exceptions are being thrown.
I am using someone else's server which has worked well for many people so I am assuming the problem is with my client's code.
When I run a single instance of the client it works perfectly, but if I run two instances of the client on the same computer the listener stops responding when the 2nd client logs in.
# server is from socket module # chat_box is a tkinter ListBox class listener_thread(threading.Thread): def __init__(self, server, chat_box): super(listener_thread, self).__init__() self.server = server self.chat_box = chat_box def run(self): try: update = self.server.recv(1024) msg = update.decode("utf-8") if msg != "": self.chat_box.insert(END, msg) except Exception as e: print(e)I've verified that the server is putting each client on a different port. The server is receiving the messages. When 'Michael' logs in and says 'Hi' it updates in his chat_box.
Though, the clients are no longer updating their histories after 'Dave' logs in.
Yet, the server continues to show that it is receiving the messages from both clients.
Output: Michael - ('127.0.0.1', 56263) connected
Hi
Dave - ('127.0.0.1', 56264) connected
Yo
Hi
I'm not sure on which board I should place this question; it might be networking or it might be threading. The network connection is working properly. It just locks up the list_box updating threads.
No exceptions are being thrown.