2 #include <samchon/API.hpp> 4 #include <samchon/protocol/Communicator.hpp> 41 std::unique_ptr<boost::asio::io_service> io_service;
43 std::unique_ptr<boost::asio::ip::tcp::endpoint> endpoint;
57 this->listener = listener;
87 virtual void connect(
const std::string &ip,
int port)
95 void _Connect(
const std::string &ip,
int port)
97 if (socket !=
nullptr && socket->is_open() ==
true)
98 throw std::logic_error(
"Already connected");
100 io_service.reset(
new boost::asio::io_service());
101 endpoint.reset(
new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(ip), port));
103 socket.reset(
new boost::asio::ip::tcp::socket(*io_service, boost::asio::ip::tcp::v4()));
104 socket->connect(*endpoint);
virtual ~ServerConnector()=default
ServerConnector(IProtocol *listener)
virtual void connect(const std::string &ip, int port)