2 #include <samchon/protocol/IServer.hpp> 7 #include <boost/asio.hpp> 26 if (acceptor !=
nullptr)
32 if (acceptor !=
nullptr && acceptor->is_open() ==
true)
35 boost::system::error_code error;
37 unique_ptr<tcp::endpoint> endPoint;
39 if (acceptor ==
nullptr)
41 string &myIP = MY_IP();
43 if (myIP.empty() ==
true)
44 endPoint.reset(
new tcp::endpoint(tcp::v4(), PORT()) );
46 endPoint.reset(
new tcp::endpoint( address::from_string(myIP), PORT() ) );
48 acceptor =
new tcp::acceptor(ioService, *endPoint);
53 tcp::socket *socket =
new tcp::socket(ioService);
54 acceptor->accept(*socket, error);
69 if (acceptor ==
nullptr)
virtual void close()
Close the server.
virtual auto MY_IP() const -> std::string
(optional) Server's IP
Package of network protocol and libraries.
IServer()
Default Constructor.
virtual void addClient(Socket *)=0
Handling connection of a physical client.
virtual void open()
Open the server.
Top level namespace of products built from samchon.