///////////////////////////////////////////////////////////////////// // CommStreamRcvr.cpp - Receives Messages from oCommStreamAdapter // // // // Jim Fawcett, CSE776 - Design Patterns for Adapter Pattern // ///////////////////////////////////////////////////////////////////// #include "../MsgPassingComm/Comm.h" #include "../Message/Message.h" using namespace MsgPassingCommunication; int main() { std::cout << "\n Demonstrating oCommStreamAdapter Receiver"; std::cout << "\n ==========================================="; SocketSystem ss; EndPoint ep("localhost", 8080); Comm comm(ep, "testComm"); comm.start(); while (true) { Message rcvd = comm.getMessage(); //rcvd.show(); if (rcvd.containsKey("content")) { std::string value = rcvd.attributes()["content"]; std::cout << "\n " << value; if (value == "quit") { break; } } } std::cout << "\n quitting"; comm.stop(); std::cout << "\n\n"; return 0; }