Yes, you have right!, I send you the real program. For the other discussion...I have used only the MPI2 rouines inside my programs and nothinf other. Then is not possible that it doesn't works. I can understand, for example, that inside Open_MPI the threads or the Client- Server routines are realized in different way, but the output have to be the same and particularly has to be the same of the protocol says. Then is I generate a program under the rigorous respect of the MPI protocol, why this program has not to work in different implementations? I want repeat again that I've compiled this program in both implementations withouts error s or warnings, but when I execute it in Open_MPI it doesn't work!
Following I have put my exact server and client codes: SERVER.C code: #include <stdio.h> #include "mpi. h" #include "string.h" #include <sys/types.h> #include <unistd.h> #define MAX_DATA 20 /* Global variables */ MPI_Comm client; char port_name[MPI_MAX_PORT_NAME]; char buf; int main(int argc,char *argv []) { int myid,numprocs,namelen, provided; char processor_name [MPI_MAX_PROCESSOR_NAME]; /* Initialization MPI structure */ MPI_Init (NULL,NULL); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank (MPI_COMM_WORLD,&myid); MPI_Get_processor_name (processor_name, &namelen); printf("server Process Rank %d ,TOT processes %d on %s\n", myid,numprocs, processor_name); MPI_Open_port (MPI_INFO_NULL, port_name); if(argv[1]==NULL) { printf("You must insert a server name!!!\n"); MPI_Close_port(port_name); /*chiudo la porta*/ MPI_Finalize(); return 0; } MPI_Publish_name(argv[1],MPI_INFO_NULL, port_name); printf("Server %s available at %s\n",argv[1],port_name); if (MPI_Comm_accept(port_name,MPI_INFO_NULL,0,MPI_COMM_WORLD,&clie nt)! =MPI_SUCCESS) { printf("No client available\n"); } MPI_Send ("HELLO CLIENT\n",MAX_DATA,MPI_CHAR,0,1,client); MPI_Comm_disconnect (&client); MPI_Close_port(port_name); /*close port*/ MPI_Unpublish_name (argv[1], MPI_INFO_NULL,port_name); MPI_Finalize(); return 0; } CLIENT.c code: #include <stdio.h> #include "mpi.h" #include "string. h" #include "unistd.h" #define MAX_DATA 20 int main(int argc, char *argv[]) { int myid,numprocs,namelen,op; char processor_name [MPI_MAX_PROCESSOR_NAME]; MPI_Comm server; MPI_Status status; char port_name[MPI_MAX_PORT_NAME]; char buf[MAX_DATA]; /* Initialization MPI structure */ MPI_Init(NULL,NULL); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD,&myid); MPI_Get_processor_name (processor_name,&namelen); printf("Rank Client Process %d ,TOT processes %d on %s\n",myid,numprocs,processor_ name); if(argv[1] ==NULL) { printf("You must insert a server name!!!\n"); MPI_Finalize(); return 0; } while(MPI_Lookup_name(argv[1], MPI_INFO_NULL,port_name)!=MPI_SUCCESS) { printf("Name Server supplied don't found or the server is power down!\n"); } printf("Server Name found!\n"); if(MPI_Comm_connect(port_name,MPI_INFO_NULL,0, MPI_COMM_WORLD,&server)==MPI_ERR_PORT){ printf("Connection error\n"); MPI_Finalize(); return 0; } else{ printf ("Connection OK!\n"); printf ("Server address %s\n", port_name); } MPI_Recv(buf,MAX_DATA,MPI_CHAR, MPI_ANY_SOURCE,MPI_ANY_TAG,server, &status); printf("The server has written: %s", buf); MPI_Comm_disconnect (&server); printf("The Client is disconnected!\n"); MPI_Finalize(); return 0; } Later that i have compiled the two C files I have executed the following commands: mpiexec -np 1 server BOB mpiexec -np 1 client BOB N.B. I have used the argv[] to recover the server name to publish or to lookup(for ex. BOB). I hope that you will be able to fix this bug! Bye A.A. Isola