I am trying to implement an app/thread that listens to an ipaddr:port
on which another app/thread is already listening. I know I need to update both the apps to set SO_REUSEADDR
in setsockopt(...)
before bind()
to avoid "Address Already in use" error when the 2nd app tries to bind()
.
The problem is that these apps(libs) are in an existing system that uses ZeroMQ on it's own. I cannot use linux socket lib directly. I have to use ZeroMQ sockets only.
Apparently zmq::setsockopt()
does not understand SO_REUSEADDR
as an option as its not defined in the zmq.h
header. At least there is no ZMQ_SO_REUSEADDR
Or may be I am not using the right option.
Can someone help me with this issue. Does ZMQ socket support SO_REUSEADDR
or not support at all, in which case how to go about this issue?