[zeromq-dev] Access ZeroMQ Error Messages in C++?

Richard_Newton at waters.com Richard_Newton at waters.com
Tue Jul 30 10:07:09 CEST 2013

Hi Riskybiz

Assuming you are using cppzmq it will throw an exception, so you can do:

catch (const zmq::error_t& e)
	std::string errStr = e.what();


From:	Riskybiz <riskybizLive at live.com>
To:	zeromq-dev at lists.zeromq.org
Date:	28/07/2013 07:01 PM
Subject:	[zeromq-dev] Access ZeroMQ Error Messages in C++?
Sent by:	zeromq-dev-bounces at lists.zeromq.org

So I’ve worked out how to get ZeroMQ error messages like so:

int rc = zmq_bind(server, "tcp://*:5555");

    if(rc == -1)


    std::string errStr =  zmq_strerror(zmq_errno());

    std::string errConc = "TestDataAccess: ZMQServer: Bind To REP Failed: " + errStr;

    const char* errOut = errConc.c_str();


    return 1;


Question is; how do I catch ZeroMQ error messages in C++;  say if I wanted to use:


the obvious way I tried:

int rc = client.connect("tcp://localhost:5555");

is just not valid because;


returns type ‘void’.

Can anyone provide a quick C++ example of how to accomplish this?


zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

The information in this email is confidential, and is intended solely for the addressee(s). 
Access to this email by anyone else is unauthorized and therefore prohibited.  If you are 
not the intended recipient you are notified that disclosing, copying, distributing or taking 
any action in reliance on the contents of this information is strictly prohibited and may be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130730/0e490d6f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130730/0e490d6f/attachment.gif>

More information about the zeromq-dev mailing list