Python Forum
Chat box locking up with multiple clients running
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chat box locking up with multiple clients running
#2
I solved my own problem.
I needed to make the chat_history_listbox as a ListBox initially, instead of None
I needed to put the receive code into a function, with a loop and an exit condition
def receive_func():
    global server, chat_history_listbox
    while True:
        try:
            update = server.recv(1024)
        except OSError as e:
            update = None
            break
            connect()
        msg = update.decode("utf-8")
        if msg != "":
            chat_history_listbox.insert(END, msg)
I needed to make the thread call a function and make it a daemon
listener = Thread(target=receive_func, daemon=True)
listener.start()
This got it working with multiple clients
Reply


Messages In This Thread
RE: Chat box locking up with multiple clients running - by Clunk_Head - Nov-27-2019, 04:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to split socket data onto multiple clients for separate processing ConcealedFox70 0 1,953 Jan-11-2022, 08:26 PM
Last Post: ConcealedFox70
  Chat (Client-Server) andresdrr 3 3,786 Aug-26-2019, 02:01 PM
Last Post: ThomasL
  Issues in Chat App for Local Network iMuny 2 2,705 Aug-19-2019, 10:25 AM
Last Post: iMuny
  Socket won't receive data suddenly with multiple clients SquareRoot 0 2,804 Sep-06-2017, 09:09 PM
Last Post: SquareRoot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020