Boost 1.47.0ãããtcp::iostreamã«ã¿ã¤ã ã¢ã¦ããè¨å®ã§ããããã«ãªãã¾ãã
ã¿ã¤ã ã¢ã¦ãã®è¨å®ã«ã¯ãæ°ãã«è¿½å ãããexpires_from_now()ãexpires_at()ã使ç¨ãã詳細ãªã¨ã©ã¼å
容ã¯ãåããBoost 1.47.0ãã追å ãããerror()ã¡ã³ãé¢æ°ã«ãã£ã¦error_codeãåå¾ãã¦ç¢ºèªã§ãã¾ãã
#include <iostream> #include <boost/asio.hpp> namespace asio = boost::asio; using asio::ip::tcp; int main() { tcp::iostream s; // ã¿ã¤ã ã¢ã¦ãè¨å® s.expires_from_now(boost::posix_time::seconds(60)); s.connect("127.0.0.1", "31400"); s << "Hello"; if (!s) { std::cout << "error: " << s.error().message() << std::endl; } else { std::cout << "OK" << std::endl; } }
追è¨ï¼
ãã®ã¿ã¤ã ã¢ã¦ãã®è¨å®ã¯ããã·ã¼ã±ã³ã¹å
¨ä½ãNç§ä»¥å
ã«å®äºããªããã°ãªããªããã¨ãããã®ã®ããã§ãã