5.4.6.1 Simplest Example -- Completely Portable.

The following example shows the simplest way to use the client/server interface. It does not use service names at all.

On the server side:

   
    char myport[MPI_MAX_PORT_NAME];
    MPI_Comm intercomm;
    /* ... */
    MPI_Open_port(MPI_INFO_NULL, myport);
    printf("port name is: %s\n", myport);

    MPI_Comm_accept(myport, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm);
    /* do something with intercomm */
The server prints out the port name to the terminal and the user must type it in when starting up the client (assuming the MPI-/ implementation supports stdin such that this works). On the client side:
    MPI_Comm intercomm;
    char name[MPI_MAX_PORT_NAME];
    printf("enter port name: "); 
    gets(name);
    MPI_Comm_connect(name, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm);

MPI-Standard for MARMOT