CppServer  1.0.0.0
C++ Server Library
bus.cpp
Go to the documentation of this file.
1 
9 #include "server/nanomsg/bus.h"
10 
11 namespace CppServer {
12 namespace Nanomsg {
13 
14 bool Bus::Link(const std::string& address)
15 {
16  if (!IsStarted())
17  return false;
18 
19  try
20  {
21  return socket().Link(address);
22  }
23  catch (CppCommon::SystemException& ex)
24  {
25  onError(ex.system_error(), ex.string());
26  return false;
27  }
28 }
29 
30 } // namespace Nanomsg
31 } // namespace CppServer
Nanomsg bus node definition.
bool Link(const std::string &address)
Link the socket to the remote endpoint.
Definition: socket.cpp:210
Socket & socket() noexcept
Get the Nanomsg socket.
Definition: server.h:48
C++ Server project definitions.
Definition: asio.h:24
bool IsStarted() const noexcept
Is the server started?
Definition: server.h:51
virtual void onError(int error, const std::string &message)
Handle error notification.
Definition: server.h:154
bool Link(const std::string &address)
Link the current bus node to another one.
Definition: bus.cpp:14