3 using STG::SGCP::UNIXProto;
5 UNIXProto::UNIXProto(ba::io_service& ios)
11 UNIXProto::~UNIXProto()
16 ConnectionPtr UNIXProto::connect(const std::string& address, uint16_t /*port*/)
19 ConnectionPtr conn = boost::make_shared(m_ios);
20 conn.socket().connect(ba::local::stream_protocol::enpoint(address), ec);
22 throw Error(ec.message());
27 void UNIXProto::bind(const std::string& address, uint16_t /*port*/, Proto::AcceptHandler handler)
30 m_acceptor.bind(address, ec);
32 throw Error(ec.message());
34 UNIXConn* conn = new UNIXConn(m_ios);
35 m_acceptor.async_accept(conn->socket(), conn->endpoint(), boost::bind(&UNIXProto::m_handleAccept, this, conn, handler, boost::_1);
38 void UNIXProto::m_handleAccept(UNIXConn* conn, Proto::AcceptHandler handler, const boost::system::error_code& ec)
42 handler(NULL, "", ec.message());
45 handler(conn, conn->enpoint().path(), "");