active socket
This commit is contained in:
parent
b0f6c466b9
commit
34860ac25f
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
#include "src/sdk.h"
|
||||
//
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
|
Loading…
Reference in New Issue