title: Send/Receive messages at the same time socket python
body: <p>I have been working on a simple python socket chat room where the client and server can send messages to each other. The issue that I came across was that the server and client can only send one message at a time. 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</p>
  
  <h1>Server.py</h1>
  
  <pre><code>import socket
  import sys
  
  s = socket.socket()
  host = socket.gethostname()
  print(" server will start on host : ", host)
  port = 8080
  s.bind((host,port))
  name = input(str("Please enter your username: "))
  print("")
  print("Server is waiting for incoming connections")
  print("")
  s.listen(1)
  conn, addr = s.accept()
  print("Recieved connection")
  print("")
  s_name = conn.recv(1024)
  s_name = s_name.decode()
  print(s_name, "has joined the chat room")
  conn.send(name.encode())
  
  while 1:
      message = input(str("Please enter your message: "))
      conn.send(message.encode())
      print("Sent")
      print("")
      message = conn.recv(1024)
      message = message.decode()
      print(s_name, ":" ,message)
      print("")
  </code></pre>
  
  <h1>Client.py</h1>
  
  <pre><code>import socket
  import sys
  
  s = socket.socket()
  host = input(str("Please enter the hostname of the server : "))
  port = 8080
  s.connect((host,port))
  name = input(str("Please enter your username : "))
  print(" Connected to chat server")
  
  s.send(name.encode())
  s_name = s.recv(1024)
  s_name = s_name.decode()
  print("")
  print(s_name, "has joined the chat room ")
  
  while 1:
      message = s.recv(1024)
      message = message.decode()
      print(s_name, ":" ,message)
      print("")
      message = input(str("Please enter your message: "))
      message = message.encode()
      s.send(message)
      print("Sent")
      print("")
  </code></pre>