Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Server:
- _context = std::make_unique<zmq::context_t>(1);
- _socket = std::make_unique<zmq::socket_t>(*_context, ZMQ_REP);
- // Configure socket to not wait at close time
- int linger = 0;
- _socket->setsockopt(ZMQ_LINGER, &linger, sizeof(linger));
- _socket->bind("ipc:///tmp/" + _id);
- while (!_done)
- {
- try{
- _socket->recv(&request);
- _socket->send(reply);
- }
- catch
- {
- if(ex.num() == EFSM)
- {
- _socket.reset(new zmq::socket_t(*_context, ZMQ_REP));
- int linger = 0;
- _socket->setsockopt(ZMQ_LINGER, &linger, sizeof(linger));
- _socket->bind("ipc:///tmp/" + _id);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment