SNode.C
Loading...
Searching...
No Matches
httpclient.cpp File Reference
Include dependency graph for httpclient.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 httpclient.cpp.

51 {
52 core::SNodeC::init(argc, argv);
53
54 using Client = apps::http::STREAM::Client;
55
56 const Client client = apps::http::STREAM::getClient();
57
58 client.connect([instanceName = client.getConfig()->getInstanceName()](
59 const core::socket::SocketAddress& socketAddress,
60 const core::socket::State& state) { // example.com:81 simulate connnect timeout
61 switch (state) {
62 case core::socket::State::OK:
63 VLOG(1) << instanceName << ": connected to '" << socketAddress.toString() << "'";
64 break;
65 case core::socket::State::DISABLED:
66 VLOG(1) << instanceName << ": disabled";
67 break;
68 case core::socket::State::ERROR:
69 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
70 break;
71 case core::socket::State::FATAL:
72 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
73 break;
74 }
75 });
76
77 return core::SNodeC::start();
78}
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
web::http::legacy::NET::Client Client
Definition clients.h:90

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

Here is the call graph for this function: