9 static const char rcsid[] __attribute__((used)) =
"$Id: SocketPair.cpp 1653 2016-02-28 19:54:59Z sella $";
11 #include "SocketPair.h"
15 using namespace sella::net;
17 SocketPair::SocketPair() throw (SocketException) {
20 if (::socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
21 THROW2(SocketException,
"socketpair()");
24 first = UnixSocket::shared_ptr(fd[0]);
25 second = UnixSocket::shared_ptr(fd[1]);
28 SocketPair::~SocketPair() {
31 UnixSocket::shared SocketPair::getFirst(
void) {
35 UnixSocket::shared SocketPair::getSecond(
void) {
39 const SocketPair::shared SocketPair::shared_ptr() throw (SocketException) {
40 return std::make_shared<SocketPair>();