X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/70f8adff2c970496bdc45717cad49ddec0405ae7..21fb8d8eb93ddba5eb08976d013d3f956bdd19d6:/stglibs/sgcp.lib/tcp.h?ds=sidebyside diff --git a/stglibs/sgcp.lib/tcp.h b/stglibs/sgcp.lib/tcp.h index 8afa0b5e..55de821b 100644 --- a/stglibs/sgcp.lib/tcp.h +++ b/stglibs/sgcp.lib/tcp.h @@ -37,15 +37,18 @@ namespace SGCP class TCPProto : public TransportProto { public: - TCPProto(); + TCPProto(boost::asio::io_service& ios); virtual ~TCPProto(); - virtual void connect(const std::string& address, uint16_t port); - virtual ssize_t write(const void* buf, size_t size); - virtual ssize_t read(void* buf, size_t size); + virtual ConnectionPtr connect(const std::string& address, uint16_t port) = 0; + virtual void bind(const std::string& address, uint16_t port, Proto::AcceptHandler handler) = 0; + typedef boost::asio::ip::tcp protocol; private: - int m_sock; + ba::io_service& m_ios; + protocol::acceptor m_acceptor; + + void m_handleAccept(TCPConn* conn, Proto::AcceptHandler handler, const boost::system::error_code& ec) }; } // namespace SGCP