- sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- size_t max = sizeof(addr.sun_path);
- strncpy(addr.sun_path, address.c_str(), max - 1);
- addr.sun_path[max - 1] = 0; // Just in case.
- if (::connect(m_sock, reinterpret_cast<const sockaddr*>(&addr), sizeof(addr)) < 0)
- throw Error(strerror(errno));
+ bs::error_code ec;
+ ConnectionPtr conn = boost::make_shared(m_ios);
+ conn.socket().connect(ba::local::stream_protocol::enpoint(address), ec);
+ if (ec)
+ throw Error(ec.message());
+ conn->start();
+ return conn;