+ // client socket
+ unsigned int tmpadd;
+ tmpadd = (unsigned) inet_addr("127.0.0.1");
+ if (tmpadd)
+ memcpy(&add.sin_addr.s_addr, &tmpadd, sizeof(struct in_addr));
+ else
+ throw Pipe::Error("inet_addr failed");
+
+ m_p->m_fd[1] = socket(AF_INET, SOCK_STREAM, 0);
+ if (m_p->m_fd[1] < 0)
+ throw Pipe::Error("could not create socket");
+
+ m_p->nonblock(m_p->m_fd[1]);
+
+ if (connect(m_p->m_fd[1], addr, sizeof(*addr)) < 0)
+ {
+#ifdef WIN32
+ if (WSAGetLastError() != WSAEWOULDBLOCK)
+ throw Pipe::Error("could not connect to socket");
+#else
+ if (errno != EINPROGRESS)
+ throw Pipe::Error("could not connect to socket");
+#endif
+ }
+
+ // server accept