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

31 {
32 core::SNodeC::init(argc, argv);
33
34 using Client = apps::http::STREAM::Client;
35
36 const Client client = apps::http::STREAM::getClient();
37
38 client.connect([instanceName = client.getConfig().getInstanceName()](
39 const core::socket::SocketAddress& socketAddress,
40 const core::socket::State& state) { // example.com:81 simulate connnect timeout
41 switch (state) {
42 case core::socket::State::OK:
43 VLOG(1) << instanceName << ": connected to '" << socketAddress.toString() << "'";
44 break;
45 case core::socket::State::DISABLED:
46 VLOG(1) << instanceName << ": disabled";
47 break;
48 case core::socket::State::ERROR:
49 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
50 break;
51 case core::socket::State::FATAL:
52 VLOG(1) << instanceName << ": " << socketAddress.toString() << ": " << state.what();
53 break;
54 }
55 });
56
57 return core::SNodeC::start();
58}
static void init(int argc, char *argv[])
Definition SNodeC.cpp:32
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
Definition SNodeC.cpp:38
web::http::legacy::NET::Client Client
Definition clients.h:63