Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created March 5, 2015 06:46
Show Gist options
  • Save vinipsmaker/aa9cec30257fef018a03 to your computer and use it in GitHub Desktop.
Save vinipsmaker/aa9cec30257fef018a03 to your computer and use it in GitHub Desktop.
std::future<void> tcp_reader(int total)
{
char buf[64 * 1024];
auto conn = await Tcp::Connect("127.0.0.1", 1337);
do
{
auto bytesRead = await conn.read(buf, sizeof(buf));
total -= bytesRead;
}
while (total > 0);
}
int main() { tcp_reader(1000 * 1000 * 1000).get(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment