diff --git a/boost_boilerplate/CMakeLists.txt b/boost_boilerplate/CMakeLists.txt index 1f35b69..206be67 100644 --- a/boost_boilerplate/CMakeLists.txt +++ b/boost_boilerplate/CMakeLists.txt @@ -21,7 +21,7 @@ find_package(Threads REQUIRED) configure_file(config.json ${CMAKE_BUILD_RPATH} config.json COPYONLY) -add_executable(hello_async - main.cpp +add_executable(endpoint.cpp + endpoint.cpp src/sdk.h) -target_link_libraries(hello_async PRIVATE Threads::Threads) +target_link_libraries(endpoint.cpp PRIVATE Threads::Threads) diff --git a/boost_boilerplate/endpoint.cpp b/boost_boilerplate/endpoint.cpp new file mode 100644 index 0000000..2dbb4ba --- /dev/null +++ b/boost_boilerplate/endpoint.cpp @@ -0,0 +1,29 @@ +#include "src/sdk.h" +// +#include +#include + +using namespace boost; +namespace sys = boost::system; +using namespace std; + +int main() +{ + string raw_ip_address = "127.0.0.1"s; + uint32_t port_num = 3333; + sys::error_code ec; + + asio::ip::address ip_address = asio::ip::address::from_string(raw_ip_address, ec); + + if (ec.value()) + { + cout << "Failed to parse the IP address. Error code = " << ec.value() << ". Message: " + << ec.message(); + + return ec.value(); + } + + asio::ip::tcp::endpoint endpoint(ip_address, port_num); + + return EXIT_SUCCESS; +} diff --git a/boost_boilerplate/main.cpp b/boost_boilerplate/main.cpp deleted file mode 100644 index 7dd4c5d..0000000 --- a/boost_boilerplate/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "src/sdk.h" -// -#include -#include -#include -#include -#include - -int main() -{ - return EXIT_SUCCESS; -}