Hi Riskybiz

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

try
{
        client.connect("tcp://localhost:5555");
}
catch (const zmq::error_t& e)
{
        std::string errStr = e.what();
}

Ric.




From:   Riskybiz <riskybizl...@live.com>
To:     zeromq-dev@lists.zeromq.org
Date:   28/07/2013 07:01 PM
Subject:        [zeromq-dev] Access ZeroMQ Error Messages in C++?
Sent by:        zeromq-dev-boun...@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();


    OutputDebugStringA(errOut);


    return 1;


    }

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

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

the obvious way I tried:

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

is just not valid because;

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

returns type ‘void’.

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

Thanks,

Riskybiz.
 _______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

===========================================================
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.
===========================================================

<<inline: graycol.gif>>

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to