title: How to terminate a thread from outside or use input in multiprocessing in python
body: <p>I'm currently working on the client part in a client-server socket programming, in order
  to collect user input and receiving incoming messages from server at the same time (doesn't want to be stuck at input and not receiving or vice versa), i decided to use thread at first it worked pretty good, i'm currently implementing a timeout function e.g. closing the entire client side without manually typing input and couldn't do so (the timeout timing is calculated in the server and server can send a message), so i changed my thread to multiprocessing it can be terminated but it shows a EOF Error when it reads an input.</p>
  <p>Just wondering is there a way to run my input_command() function at the same time as receiving messages and being able to terminate both?</p>
  <pre><code>def input_command():
      
      while login:
          
          command = input()
          command_word = command.split(' ')
          
          if command == 'logout':
              clientSocket.send(command.encode('utf-8'))
              print('user has logged out')
              break
          elif command == 'whoelse':
              clientSocket.send(command.encode('utf-8'))
          else:
              clientSocket.send('giberish'.encode('utf-8'))
      clientSocket.close()
  
  
  server_port = int(sys.argv[1])
  
  serverName = 'localhost'
  
  clientSocket = socket(AF_INET, SOCK_STREAM)
  
  clientSocket.connect((serverName, server_port))
  
  login = False
  once = False
  
  while True:    
      received_message_encrypted = clientSocket.recv(1024)
      received_message = received_message_encrypted.decode('utf-8')
      if received_message == 'bye':
          clientSocket.close()
          login = False
          thread_input.terminate()
          break
  
      if login == True and once == False:
          once = True
          thread_input = multiprocessing.Process(target=input_command)
          thread_input.start()
  </code></pre>