diff --git a/main.c b/main.c
index e69de29..ddfa1ee 100644
--- a/main.c
+++ b/main.c
@@ -0,0 +1,44 @@
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/socket.h>
+
+#define BUF_SIZE    100
+
+int main(void) {
+    int fd[2];
+    pid_t pid;
+    char ch;
+    char read_buf[BUF_SIZE];
+    int count = 0;
+    socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
+    if ((pid = fork()) == 0) {
+        close(fd[0]);
+        dup2(fd[1], STDOUT_FILENO);
+        dup2(fd[1], STDIN_FILENO);
+        close(fd[1]);
+        count = 0;
+        for (;;) {
+            ch = '0' + (0xff & count++);
+            write(STDIN_FILENO, &ch, 1);
+            memset(read_buf, '0', BUF_SIZE);
+            if (read(STDIN_FILENO, read_buf, BUF_SIZE) != -1) {
+                fprintf(stderr, "C rev \"%s\"\n", read_buf);
+            }
+        }
+    } else {
+        close(fd[1]);
+        for (;;) {
+            if (read(fd[0], &ch, 1) != -1) {
+                fprintf(stderr, "P rev \"%c\"\n", ch);
+                write(fd[0], "OK!", 4);
+            }
+        }
+
+
+        shutdown(fd[0], SHUT_WR);
+        close(fd[0]);
+    }
+}
diff --git a/main.c b/main.c
index ddfa1ee..603442a 100644
--- a/main.c
+++ b/main.c
@@ -24,7 +24,7 @@ int main(void) {
             ch = '0' + (0xff & count++);
             write(STDIN_FILENO, &ch, 1);
             memset(read_buf, '0', BUF_SIZE);
-            if (read(STDIN_FILENO, read_buf, BUF_SIZE) != -1) {
+            if (read(STDIN_FILENO, read_buf, BUF_SIZE) != -1) { /* 也可以用STDOUT_FILENO */
                 fprintf(stderr, "C rev \"%s\"\n", read_buf);
             }
         }
diff --git a/main.c b/main.c
index 603442a..4bc396a 100644
--- a/main.c
+++ b/main.c
@@ -36,7 +36,6 @@ int main(void) {
                 write(fd[0], "OK!", 4);
             }
         }
-

         shutdown(fd[0], SHUT_WR);
         close(fd[0]);