34 lines
921 B
C++
34 lines
921 B
C++
#include <asio/ip/tcp.hpp>
|
|
|
|
#include "../net/adc_netproto.h"
|
|
#include "../net/asio/adc_netservice_asio.h"
|
|
|
|
int main()
|
|
{
|
|
asio::ip::tcp::endpoint ept_s(asio::ip::tcp::v4(), 9999);
|
|
asio::ip::tcp::endpoint ept_c(asio::ip::make_address_v4("127.0.0.1"), 9999);
|
|
|
|
asio::io_context ctx;
|
|
|
|
adc::impl::AdcNetServiceASIOBase<asio::ip::tcp, adc::AdcStopSeqSessionProto<>> srv(ctx);
|
|
|
|
adc::impl::AdcNetServiceASIOBase<asio::ip::tcp, adc::AdcStopSeqSessionProto<>>::asio_async_ctx_t srv_ctx;
|
|
srv_ctx.accept_comp_token = [](std::error_code ec) {
|
|
|
|
};
|
|
|
|
// srv.asyncAccept(ept_s, srv_ctx, std::chrono::seconds(120));
|
|
srv.asyncConnect(ept_c, [](std::error_code ec) {
|
|
|
|
});
|
|
|
|
adc::impl::AdcNetServiceASIOBase<asio::ip::tcp, adc::AdcStopSeqSessionProto<>>::contx_t s_ctx;
|
|
|
|
srv.asyncConnect(ept_c, s_ctx);
|
|
auto res = srv.asyncConnect(ept_c, asio::use_awaitable);
|
|
|
|
ctx.run();
|
|
|
|
return 0;
|
|
}
|