active socket

This commit is contained in:
Антон 2024-03-25 14:58:39 +03:00
parent 34860ac25f
commit 032dc6db56
2 changed files with 34 additions and 1 deletions

View File

@ -33,5 +33,11 @@ target_link_libraries(server_endpoint PRIVATE Threads::Threads)
add_executable(active_socket
active_socket.cpp
src/sdk.h)
src/sdk.h
passive_socket.cpp)
target_link_libraries(active_socket PRIVATE Threads::Threads)
add_executable(passive_socket
passive_socket.cpp
src/sdk.h)
target_link_libraries(passive_socket PRIVATE Threads::Threads)

View File

@ -0,0 +1,27 @@
#include "src/sdk.h"
#include <boost/asio.hpp>
#include <iostream>
using namespace boost;
namespace sys = boost::system;
namespace net = boost::asio;
using namespace std;
int main()
{
net::io_service ios;
net::ip::tcp protocol = net::ip::tcp::v6();
net::ip::tcp::acceptor acceptor(ios);
sys::error_code ec;
acceptor.open(protocol, ec);
if (ec.value())
{
cout << "Error"s << endl;
return ec.value();
}
return EXIT_SUCCESS;
}