ZyreControlSocket.cpp
Go to the documentation of this file.
2 #include <swarmio/Exception.h>
3 
4 using namespace swarmio;
5 using namespace swarmio::transport;
6 using namespace swarmio::transport::zyre;
7 
9 {
10  // Build name
11  char name[32];
12  snprintf(name, sizeof(name), "@inproc://%p", this);
13 
14  // Create socket
15  _socket = zsock_new_rep(name);
16  if (_socket == NULL)
17  {
18  throw Exception("Cannot create server inproc socket");
19  }
20 }
21 
23 {
24  // Build name
25  char name[32];
26  snprintf(name, sizeof(name), ">inproc://%p", target);
27 
28  // Create socket
29  _socket = zsock_new_req(name);
30  if (_socket == NULL)
31  {
32  throw Exception("Cannot create client inproc socket");
33  }
34 }
35 
37 {
38  if (_socket != NULL)
39  {
40  zsock_destroy(&_socket);
41  }
42 }
ZyreControlSocket()
Construct a new server ZyreControlSocket, where the endpoint name is determined from the in-memory lo...
virtual ~ZyreControlSocket()
Destroy the ZyreControlSocket object.
Exception class thrown by all library classes.
An inproc socket bound to a special name generated from an object pointer.


swarmros
Author(s):
autogenerated on Fri Apr 3 2020 03:42:48