SNode.C
Loading...
Searching...
No Matches
echoclient.cpp File Reference
#include "core/SNodeC.h"
#include "model/clients.h"
Include dependency graph for echoclient.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 53 of file echoclient.cpp.

53 {
54 core::SNodeC::init(argc, argv);
55
56 using SocketClient = apps::echo::model::STREAM::EchoSocketClient;
57 using SocketAddress = SocketClient::SocketAddress;
58 const SocketClient client = apps::echo::model::STREAM::getClient();
59
60 client.connect(
61 [instanceName = client.getConfig().getInstanceName()](const SocketAddress& socketAddress, const core::socket::State& state) {
62 switch (state) {
63 case core::socket::State::OK:
64 VLOG(1) << instanceName << ": connected to '" << socketAddress.toString() << "'";
65 break;
66 case core::socket::State::DISABLED:
67 VLOG(1) << instanceName << ": disabled";
68 break;
69 case core::socket::State::ERROR:
70 LOG(ERROR) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
71 break;
72 case core::socket::State::FATAL:
73 LOG(FATAL) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
74 break;
75 }
76 });
77 /*
78 client.connect([](const SocketAddress& socketAddress, const core::socket::State& state) {
79 switch (state) {
80 case core::socket::State::OK:
81 VLOG(1) << "echoclient: connected to '" << socketAddress.toString() << "'" << "'";
82 break;
83 case core::socket::State::DISABLED:
84 VLOG(1) << "echoclient: disabled";
85 break;
86 case core::socket::State::ERROR:
87 VLOG(1) << "echoclientt: error occurred";
88 break;
89 case core::socket::State::FATAL:
90 VLOG(1) << "echoclient: fatal error occurred";
91 break;
92 }
93 });
94 */
95 return core::SNodeC::start();
96}
static void init(int argc, char *argv[])
Definition SNodeC.cpp:54
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
Definition SNodeC.cpp:60
SocketClient::SocketAddress SocketAddress
net::in::stream::tls::SocketClient< apps::http::SimpleSocketProtocolFactory > SocketClient

References core::SNodeC::init(), and core::SNodeC::start().

Here is the call graph for this function: