int main()
{
zmq::context_t context(1);
// Socket to talk to clients
zmq::socket_t push (context, ZMQ_PUSH);
unsigned long long hwm;
size_t hwmsz;
push.getsockopt(ZMQ_HWM, &hwm, &hwmsz);
cout << "HWM:" << hwm << endl;
}
執行上述代碼導致以下使用zeromq 4.1.4版本的異常。對於setsockopt()
和getsockopt()
,任何套接字選項都會導致無效參數。ZeroMQ setsockopt和getsockopt返回無效參數
terminate called after throwing an instance of 'zmq::error_t'
what(): Invalid argument
Aborted (core dumped)
使用int,而不是長長對於zeromq 4.x版的HWM變量 – somdoron