title: Python Socket - Send/Receive messages at the same time
body: <p>Basically I have been working on a simple chat room using socket and thread. In my client I can receive and send messages, my issue is that one comes before another in a loop, so if I am sending a message I will only receive data once I have sent a message. I want it to work like any other chat room, where I could receive a message when I am sending a message, any help will help greatly. This is my basic client:</p>
  
  <pre><code>import socket
  import sys
  
  ###########
  HOST = '25.0.18.52'
  PORT = 9999
  ###########
  
  name = input("Enter your name: ")
  s = socket.socket()
  s.connect((HOST,PORT))
  
  while 1:
      message = input("Message: ")
      s.send("{}: {}".format(name, message).encode('utf-8'))
      data = s.recv(1024)
      a = data.decode("utf-8") 
      print(a)
  </code></pre>