title: How to handle chat client using threading and queues?
body: <p>The problem I've got right now is one concerning this chat client I've been trying to get working for some days now. It's supposed to be an upgrade of my original chat client, that could only reply to people if it received a message first.</p>
  
  <p>So after asking around and researching people I decided to use select.select to handle my client. </p>
  
  <p>Problem is it has the same problem as always. </p>
  
  <p>*<strong><em>The loop gets stuck on receiving and won't complete until it receives something</em>*</strong></p>
  
  <p>Here's what I wrote so far: </p>
  
  <pre><code>import select
  import sys #because why not?
  import threading
  import queue
  
  print("New Chat Client Using Select Module")
  
  HOST = input("Host: ")
  PORT = int(input("Port: "))
  
  s = socket(AF_INET,SOCK_STREAM)
  
  print("Trying to connect....")
  s.connect((HOST,PORT))
  s.setblocking(0)
  # Not including setblocking(0) because select handles that. 
  print("You just connected to",HOST,)
  
  # Lets now try to handle the client a different way!
  
  while True:
      #     Attempting to create a few threads
      Reading_Thread = threading.Thread(None,s)
      Reading_Thread.start()
      Writing_Thread = threading.Thread()
      Writing_Thread.start()
  
  
  
      Incoming_data = [s]
      Exportable_data = []
  
      Exceptions = []
      User_input = input("Your message: ")
  
      rlist,wlist,xlist = select.select(Incoming_data,Exportable_data,Exceptions)
  
      if User_input == True:
          Exportable_data += [User_input]
  </code></pre>
  
  <p>Your probably wondering why I've got threading and queues in there. </p>
  
  <p>That's because people told me I could solve the problem by using threading and queues, but after reading documentation, looking for video tutorials or examples that matched my case. I still don't know at all how I can use them to make my client work. </p>
  
  <p>Could someone please help me out here? I just need to find a way to have the client enter messages as much as they'd like without waiting for a reply. This is just one of the ways I am trying to do it. </p>