GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — cpp-patterns/python_zmq_communication/server.cpp at master · hmenke/cpp-patterns Expand file tree/ Copy pathserver.cppMore file actions 36 lines (31 loc) · 1023 Bytes / Copy pathserver.cppFile metadata and controls36 lines (31 loc) · 1023 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #include "communication.h" #include "server.h" #include <chrono> #include <iostream> #include <thread> void perform(int nseconds, std::string const& endpoint) { std::cout << "Welcome to perform()" << std::endl; // Prepare our context and socket std::cout << "Create context" << std::endl; zmq::context context; std::cout << "Create socket" << std::endl; zmq::socket publisher = context.socket(ZMQ_PUB); std::cout << "Connect socket to endpoint" << std::endl; publisher.connect(endpoint.c_str()); std::cout << "Enter the waiting loop" << std::endl; #pragma omp parallel for for (int i = 0; i < 5; ++i) { std::cout << "Waiting for " << nseconds << " s" << std::endl; std::this_thread::sleep_for(std::chrono::seconds{nseconds}); #pragma omp critical { std::cout << "Sending loop index " << i << std::endl; publisher.send("%1d", i); } } std::cout << "Sending end signal" << std::endl; publisher.send(">>END" ); std::cout << "Bye... :-)" << std::endl; } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |