title: client/server application using MPI
body: <p>i have two questions ; the first one is :</p>
  
  <p>i'm gonna use msmpi and i meant by "only mpi" that we mustn't use sockets, my application is about a scalable distributed data structure; initially, we have a server contain a file which has a variable size (the size could be increased by insertions and decreased by deletion) and when the size of the file exceed certain limit the file will be splitted, the half remain in the first server and the second half will be moved to a new server and so on... and the client need to be always informed by the address of the data he want to retrieve so he should have an image of the split operation of the file. finally, i hope i make it clearer.</p>
  
  <p>and the second one is:</p>
  
  <p>i've tried to compile simple client/server application(the code source is bellow) with msmpi or mpich2 and it doesn't work and gives me the error message "fatal error in mpi_open_port() and other errors of stack", so i installed open mpi on ubunto 11.10, and tried to run the same example it worked with server side and it gave me a port name but on the client side it gave me the error message:</p>
  
  <pre><code>[user-Compaq-610:03833] [[39604,1],0] ORTE_ERROR_LOG: Not found in file ../../../../../../ompi/mca/dpm/orte/dpm_orte.c at line 155
  [user-Compaq-610:3833] *** An error occurred in MPI_Comm_connect
  [user-Compaq-610:3833] *** on communicator MPI_COMM_WORLD
  [user-Compaq-610:3833] *** MPI_ERR_INTERN: internal error
  [user-Compaq-610:3833] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
  --------------------------------------------------------------------------
  mpirun has exited due to process rank 0 with PID 3833 on
  node toufik-Compaq-610 exiting without calling "finalize". This may
  have caused other processes in the application to be
  terminated by signals sent by mpirun (as reported here).
  </code></pre>
  
  <p>so i'm confused what the problem is, and i spent a while trying to fix it,
  i'd be greatfull if any body could help me with it, and thank u in advance.  </p>
  
  <p>the source code is here:</p>
  
  <pre><code>/* the server side */
  #include &lt;stdio.h&gt;
  #include &lt;mpi.h&gt;
  
  main(int argc, char **argv)
  {
      int my_id;
      char port_name[MPI_MAX_PORT_NAME];
      MPI_Comm newcomm;
      int passed_num;
  
      MPI_Init(&amp;argc, &amp;argv);
      MPI_Comm_rank(MPI_COMM_WORLD, &amp;my_id);
  
      passed_num = 111;
  
      if (my_id == 0)
      {
      MPI_Open_port(MPI_INFO_NULL, port_name);
      printf("%s\n\n", port_name); fflush(stdout);
      } /* endif */
  
      MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &amp;newcomm); 
  
      if (my_id == 0)
      {
      MPI_Send(&amp;passed_num, 1, MPI_INT, 0, 0, newcomm);
      printf("after sending passed_num %d\n", passed_num); fflush(stdout);
      MPI_Close_port(port_name);
      } /* endif */
  
      MPI_Finalize();
  
      exit(0);
  
  } /* end main() */
  </code></pre>
  
  <p>and at the client side:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;mpi.h&gt;
  
  int main(int argc, char **argv)
  {
      int passed_num;
      int my_id;
      MPI_Comm newcomm;
  
      MPI_Init(&amp;argc, &amp;argv);
      MPI_Comm_rank(MPI_COMM_WORLD, &amp;my_id);
  
      MPI_Comm_connect(argv[1], MPI_INFO_NULL, 0, MPI_COMM_WORLD, &amp;newcomm); 
  
      if (my_id == 0)
      {
      MPI_Status status;
      MPI_Recv(&amp;passed_num, 1, MPI_INT, 0, 0, newcomm, &amp;status);
      printf("after receiving passed_num %d\n", passed_num); fflush(stdout);
      } /* endif */
  
      MPI_Finalize();
  
      return 0;   
      //exit(0);
  
  } /* end main() */
  </code></pre>