Skip to content

Instantly share code, notes, and snippets.

@kennethho
Created July 11, 2012 10:53
Show Gist options
  • Save kennethho/3089638 to your computer and use it in GitHub Desktop.
Save kennethho/3089638 to your computer and use it in GitHub Desktop.
void handle_read(const sys::error_code& error,
size_t bytes_transferred)
{
if(error)
{
delete this;
return;
}
async_write(
socket_,
buffer(data_, bytes_transferred),
[this](const sys::error_code& error, size_t bytes_transferred)
{
if(error)
{
delete this;
return;
}
socket_.async_read_some(
buffer(data_, max_length),
bind(&session::handle_read, this,
placeholders::error,
placeholders::bytes_transferred));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment