Hi @dilipkha, Under the hood, Boost calls getaddrinfo on Linux, which should accept IP addresses as strings. When I compile the example with g++ 8.5.0 and Boost 1.66.0 on my RHEL 8 host, the progra...
See more...
Hi @dilipkha, Under the hood, Boost calls getaddrinfo on Linux, which should accept IP addresses as strings. When I compile the example with g++ 8.5.0 and Boost 1.66.0 on my RHEL 8 host, the program works as expected using http as the service: $ g++ -o sync_client -lboost_system -lpthread sync_client.cpp
$ chmod 0775 sync_client
$ host httpbin.org
httpbin.org has address 23.22.173.247
httpbin.org has address 52.206.0.51
$ ./sync_client 23.22.173.247 /get
Date: Sun, 28 Jan 2024 04:47:22 GMT
Content-Type: application/json
Content-Length: 225
Connection: close
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "23.22.173.247",
"X-Amzn-Trace-Id": "Root=1-65b5dc5a-2e13219829bcecc360851dcb"
},
"origin": "x.x.x.x",
"url": "http://23.22.173.247/get"
} In your implementation, you may need to use a different query constructor on line 35, e.g.: tcp::resolver::query query(argv[1], "8089", boost::asio::ip::resolver_query_base::numeric_host | boost::asio::ip::resolver_query_base::numeric_service); Note that I've also replaced "http" with "8089" to use the default Splunk management port. On most systems, the http service resolves to port 80. See e.g. /etc/services.