Skip to content

Instantly share code, notes, and snippets.

View hsnks100's full-sized avatar
😍
wow

Han Gyoung-Su hsnks100

😍
wow
View GitHub Profile
@snaewe
snaewe / read_with_timeout.cc
Created September 4, 2011 07:50
boost::asio - async read with timeout
void set_result(optional<error_code>* a, error_code b)
{
a->reset(b);
}
template <typename MutableBufferSequence>
void read_with_timeout(tcp::socket& sock,
const MutableBufferSequence& buffers)
{
optional<error_code> timer_result;
deadline_timer timer(sock.io_service());