      program example27b_server
      include 'mpif.h'
      integer r, ierr, status(MPI_STATUS_SIZE), intercomm
      character*(MPI_MAX_PORT_NAME) port_name
      call MPI_OPEN_PORT(MPI_INFO_NULL, port_name, ierr)
      call MPI_PUBLISH_NAME("example", MPI_INFO_NULL,
     &                      port_name, ierr)
      call MPI_COMM_ACCEPT(port_name, MPI_INFO_NULL, 0,
     &                     MPI_COMM_SELF, intercomm, ierr)
      call MPI_RECV(r, 1, MPI_INTEGER, 0, 0, intercomm, status,
     &              ierr)
      call MPI_UNPUBLISH_NAME("example", MPI_INFO_NULL,
     &                        port_name, ierr)
      call MPI_CLOSE_PORT(port_name, ierr)
      print *, "Client is sent", r
      call MPI_FINALIZE(ierr)
      end
