title: VB 2010 Kill thread by name
body: <p>In my multi-threading server app, a thread per client is generated in this way:</p>
  
  <pre><code>    While (True)
          counter += 1
          clientSocket = serverSocket.AcceptTcpClient()
          log.debug("Client No: " + Convert.ToString(counter) + " started!")
          Dim client As New handleClinet
          clients.Add(clientSocket)
          client.startClient(clientSocket, Convert.ToString(counter))
      End While
  </code></pre>
  
  <p>and in handleClinet:</p>
  
  <pre><code>    Public Sub startClient(ByVal inClientSocket As TcpClient, ByVal clineNo As String)
          Me.clientSocket = inClientSocket
          Me.clNo = clineNo
          Dim ctThread As Threading.Thread = New Threading.Thread(AddressOf doChat)
          ctThread.Name = "client" + clineNo
          ctThread.Start()
      End Sub
  </code></pre>
  
  <p>As you can see, the thread is made with the name client1, client2, etc. When a user signs out, a command is send to the server along with the clientID. But how can I kill the specific client process? </p>
  
  <p>Something like:</p>
  
  <pre><code>Public Sub killClient(ByVal clientID As Int32)
      'Code to kill "client"+clientID
  End Sub
  </code></pre>