I have a program that every time a client connects to the server, a new thread is created for that client.

When the login has been unsuccessful, then the server should destroy the thread that was created to handle that client.

How do I destroy the thread or terminate it ? so when the client wants to try to login again, a new thread will handle it ?