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 53 of file httpclient.cpp.

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