Boost::Asio synchronous client with timeout
问题 I´m trying to build a synchronous FTP client code with timeout using a thread as the timeout control. The thread will be started on every transaction and will close the socket in case of timeout - that will force the syncronous call to return with error. So here is my code: #include <cstdlib> #include <cstring> #include <iostream> #include <thread> #include <chrono> #include <boost/asio.hpp> #define TIMEOUT_SECONDS 5 #define MAX_MESSAGE_SIZE 4096 using boost::asio::ip::tcp; enum { max_length