Skip to content

Instantly share code, notes, and snippets.

@argv0
Created October 29, 2013 18:48
Show Gist options
  • Save argv0/7220397 to your computer and use it in GitHub Desktop.
Save argv0/7220397 to your computer and use it in GitHub Desktop.
struct echo_service
{
struct handler : public handler_base
{
handler(ip::tcp::socket& socket) : handler_base(socket) {}
void handle_data(const std::string& readbuf)
{
io::async_write(socket_, buffer(readbuf), ignore());
}
};
typedef transport::tcp transport;
typedef raw_receiver<handler> protocol;
};
typedef server<echo_service> echo_server;
int main(void) {
std::make_shared<echo_server>("127.0.0.1", "8092")->start();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment