Open heipi666 opened 1 year ago
if you want to call send funciton in non-block behavior , can you add the ZMQ_DONTWAIT flag to send function. maybe this can help you.
Thank you for your answer, I didn’t mean that, I meant that the send function should be blocked by default, but when I use this class to define an object in the heap area, calling the send function becomes non-blocking
Can you write a minimal program where this happens?
class Pusher { public: Pusher(const std::string& addr) : context(1), socket(context_, ZMQ_PUSH) { try { int send_buffersize = 1024 * 1024; socket.setsockopt(ZMQ_SNDBUF,&send_buffer_size,sizeof(send_buffersize)); socket.connect(addr.c_str()); } catch (const zmq::error_t& e) { // 错误处理 std::cerr << "Error occurred: " << e.what() << std::endl; exit(1); } }
private: zmq::contextt context; zmq::sockett socket; };