Lines Matching full:sockets
36 * This program creates a pair of connected sockets then forks and
44 int sockets[2], child;
47 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) {
55 close(sockets[0]);
56 if (read(sockets[1], buf, 1024, 0) < 0)
59 if (write(sockets[1], DATA2, sizeof(DATA2)) < 0)
61 close(sockets[1]);
63 close(sockets[1]);
64 if (write(sockets[0], DATA1, sizeof(DATA1)) < 0)
66 if (read(sockets[0], buf, 1024, 0) < 0)
69 close(sockets[0]);