I have a server which listens to clients in a while(true) loop. I keep every client's hostname in a list and save the time the client contact the server. I would like to check every 10 minutes if some of the clients didn't contact the server in the last hour and to print its name. I thought about doing something like this:
Task.Run(CheckTheClients()) //Check the passed-time of each client in the list
while(true)
{
//listen to clients, add them to list, etc.
}
But I'm not sure how to do the check every 10 minutes and not every millisecond, neither if my idea is good or not. So What is the best way to do this? Moreover, both the function and the while(true) touches the list of the clients. Is that going to make some problems?