Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create svr.cpp #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions 778/svr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <zmq.hpp>
#include "zhelpers.hpp"

int main () {
zmq::context_t context(1);


std::string lInterAddr = "tcp://127.0.0.1:6666";


zmq::socket_t lHarbor(context, ZMQ_ROUTER);
lHarbor.setsockopt( ZMQ_IDENTITY, "POINT1", 6);

int linger = 0;
lHarbor.setsockopt (ZMQ_LINGER, &linger, sizeof (linger));

int lvalue = 1;
lHarbor.setsockopt( ZMQ_ROUTER_MANDATORY, &lvalue, sizeof(lvalue));
lHarbor.bind( lInterAddr.c_str());
//std::string lExternAddr = "tcp://127.0.0.1:7777";
// lHarbor.connect( lEcternAddr.c_str());

bool lrs=false;

while(1)
{
printf("Put any key to send another msg\n");
getchar();
lrs = s_sendmore (lHarbor, "POINT2");
lrs = s_send (lHarbor, "Send From lPoint1");
}

return 0;
}