Last active
August 29, 2015 14:01
-
-
Save heapwolf/e56a27dca6c13a890996 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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