[zeromq-dev] Connect to a different host, same socket.
Oliver Smith
oliver at kfs.org
Wed Aug 4 19:48:27 CEST 2010
Using C++, I wanted to do the following:
{
static zmq::socket_t socket(zmqContext, ZMQ_UPSTREAM) ;
static const char* connectedTo = NULL ;
if ( connectedTo != NULL )
{
socket.close() ; // Disconnect previous connection
}
if ( connectedTo != newDestination )
{
if ( socket.connect(newDestination) != 0 )
throw std::invalid_argument("Couldn't connect to
destination") ;
else
connectedTo = newDestination ;
}
socket.send(data) ;
}
But the only way to close a socket in C++ seems to be to destroy the
socket_t?
- Oliver
More information about the zeromq-dev
mailing list