This commit is contained in:
Timur A. Fatkhullin
2024-10-30 00:09:30 +03:00
parent daa756d8c6
commit f14b4fdc10
3 changed files with 22 additions and 8 deletions

View File

@@ -29,6 +29,10 @@ int main(int argc, char* argv[])
}
asio::io_context io_ctx;
asio::signal_set signals(io_ctx, SIGINT, SIGTERM);
signals.async_wait([&](std::error_code, int) { io_ctx.stop(); });
adc::impl::AdcDeviceNetServerASIO server("TEST SRV", io_ctx);
server.setupSignals();
@@ -63,6 +67,7 @@ int main(int argc, char* argv[])
return 127;
} catch (const std::system_error& ex) {
std::cerr << "\nAn error ocured: " << ex.what() << "\n";
std::cerr << "Category: " << ex.code().category().name() << "; message: " << ex.code().message() << "\n";
return 128;
}

View File

@@ -21,14 +21,14 @@ void receive(T srv)
int main()
{
using tr_p_t = asio ::ip::tcp;
// using tr_p_t = asio::local::stream_protocol;
// using tr_p_t = asio ::ip::tcp;
using tr_p_t = asio::local::stream_protocol;
// using tr_p_t = asio::local::seq_packet_protocol;
// tr_p_t::endpoint ept_c(std::string("/tmp/AAA").insert(0, 1, '\0'));
tr_p_t::endpoint ept_c(std::string("/tmp/AAA").insert(0, 1, '\0'));
// tr_p_t::endpoint ept_c("/tmp/AAA");
// tr_p_t::endpoint ept_c(asio::ip::make_address_v4("0.0.0.0"), 9999);
tr_p_t::endpoint ept_c(asio::ip::make_address_v4("0.0.0.0"), 9999);
std::cout << "ADDR: " << ept_c << "\n";
asio::io_context ctx;