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

zmq::multipart_t::send() only takes socket_t & argument, not socket_ref #448

Closed
jeroenmuller opened this issue Oct 5, 2020 · 2 comments
Closed

Comments

@jeroenmuller
Copy link

Using 4.8.0 with draft APIs enabled.

I am using the poller with zmq::multipart_t. The poller event gives me a socket_ref. However, multipart_t::send() only accepts a reference to a socket (not the socket_ref class). Therefore, I get a compiler error of this form:

src/mesh.cpp:36:29: error: cannot convert ‘zmq::socket_ref’ to ‘zmq::socket_t&’

An example of the code that leads to this issue (but I assume every case where we want to pass a socket_ref to multipart_t would lead to the same issue):

std::vector<zmq::poller_event<size_t>> events{10};
size_t num_events;
while ((num_events = d_in_poller.wait_all(events, std::chrono::milliseconds{0}))) {
	for (size_t i = 0; i != num_events; i++) {
		zmq::multipart_t multipart;
		multipart.recv(*(events[i].socket);
@gummif
Copy link
Member

gummif commented Oct 5, 2020

Good point. This can be easily fixed, you are welcome to submit a PR if you can.

@gummif
Copy link
Member

gummif commented Oct 5, 2020

An alternative is to use the recv_multipart and send_multipart functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants