mercredi 13 novembre 2019

How to wait for a value with timeout

I have a server and client programs written in C++. I want to check the client response through a command send by the server, with a timeout if no response.

I am waiting for an expected value during some seconds.

I think about a thread and a poll to check the expected value during a duration.

I am wondering if C++11/14 features - std::promise, std::future, std::condition_variable or something else - can do it more easily. The inconvenient i see about it is that i have to notice each changing value with a notify.

Well, i need some advices.

Aucun commentaire:

Enregistrer un commentaire