endpoint
This commit is contained in:
parent
a2d1d11167
commit
33208be2b8
|
@ -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)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#include "src/sdk.h"
|
||||
//
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#include "src/sdk.h"
|
||||
//
|
||||
#include <boost/asio/signal_set.hpp>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue