Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heapwolf/e56a27dca6c13a890996 to your computer and use it in GitHub Desktop.
Save heapwolf/e56a27dca6c13a890996 to your computer and use it in GitHub Desktop.
/*
* To compile
*
* smpl net.cc
*
*/
#include <net>
#include <through>
using namespace through;
using namespace net;
//
// A through stream that just uppercases the data.
//
auto upperCase = Through([](auto s) {
this << s.toUpperCase();
};
int main() {
//
// echo server
//
auto server = Server([](auto s) {
s << upperCase << s;
});
//
// reusing variables
//
server.listen(8000, [] {
cout << "listening";
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment