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 51 of file echoclient.cpp.

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

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

Here is the call graph for this function: