title: Pipe communicating between the child and the parent using 2 pipes
body: <pre><code>#include&lt;dirent.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;unistd.h&gt;
  
  int main()
  {
      int canal_son[2];
      int canal_father[2];
      pipe(canal_father);
      pipe(canal_son);
      char mesaj_son[20];
      char mesaj_father[20];
  
      if (fork()==0)
      {
          printf("Son %d\n",getpid());
          read(canal_father[0],mesaj_father,4);
          int j;
          for(j=0;j&lt;5;j++) 
          {
              printf("The message from father is: %s \n",mesaj_father);
              read(canal_father[0],mesaj_father,4);
              write(canal_son[1],"son",3);
          }
          exit(0);
      }
  
      int i=5;
      for (i=0;i&lt;5;i++)
      {
          write(canal_father[1],"mesas",4);
          read(canal_son[0],mesaj_son,10);
          printf("we are in father:%s\n",mesaj_son);
      }
  }
  </code></pre>
  
  <p>What I am trying to do is create to pipes for communicating between child and father, the only problem is when i try to use both, my process freezes, it is like it's expecting some input, if i only use one pipe, canal_father or canal_son it all works perfectly, does anyone have an idea what is wrong with using 2 pipes?</p>
  
  <p>Thanks a lot.</p>