active socket

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

View File

@ -30,3 +30,8 @@ add_executable(server_endpoint
server_endpoint.cpp
src/sdk.h)
target_link_libraries(server_endpoint PRIVATE Threads::Threads)
add_executable(active_socket
active_socket.cpp
src/sdk.h)
target_link_libraries(active_socket PRIVATE Threads::Threads)

View File

@ -0,0 +1,28 @@
#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_context ios;
net::ip::tcp protocol = net::ip::tcp::v4();
net::ip::tcp::socket socket(ios);
sys::error_code ec;
socket.open(protocol, ec);
if (ec.value())
{
cout << "Error!!" << endl;
}
return EXIT_SUCCESS;
}

View File

@ -1,5 +1,4 @@
#include "src/sdk.h"
//
#include <boost/asio.hpp>
#include <iostream>