18 #include "my_global.h"
20 #include "ndb_socket.h"
31 struct sockaddr_in addr;
32 SOCKET_SIZE_TYPE addrlen =
sizeof(addr);
35 my_socket_invalidate(&listener);
36 my_socket_invalidate(&s[0]);
37 my_socket_invalidate(&s[1]);
39 listener= my_socket_create(AF_INET, SOCK_STREAM, 0);
40 if (!my_socket_valid(listener))
43 bzero(&addr,
sizeof(addr));
44 addr.sin_family = AF_INET;
45 addr.sin_addr.s_addr = htonl(0x7f000001);
49 if (my_bind_inet(listener, &addr) == -1)
57 if (getsockname(listener.s, (
struct sockaddr*)&addr, &addrlen) < 0)
60 if (my_listen(listener, 1) == -1)
63 s[0]= my_socket_create(AF_INET, SOCK_STREAM, 0);
65 if (!my_socket_valid(s[0]))
68 if (my_connect_inet(s[0], &addr) == -1)
71 s[1]= my_accept(listener, 0, 0);
72 if (!my_socket_valid(s[1]))
75 my_socket_close(listener);
80 int save_errno = my_socket_errno();
82 if (my_socket_valid(listener))
83 my_socket_close(listener);
85 if (my_socket_valid(s[0]))
86 my_socket_close(s[0]);
88 if (my_socket_valid(s[1]))
89 my_socket_close(s[1]);
91 my_socket_set_errno(save_errno);
102 ret= socketpair(AF_UNIX, SOCK_STREAM, 0, sock);