Example #1
0
File: mpiPi.c Project: saxena/mpip
void
mpiPi_finalize ()
{
  if (mpiPi.disable_finalize_report == 0)
    mpiPi_generateReport (mpiPi.report_style);

  /* clean up data structures, etc */
  h_close (mpiPi.task_callsite_stats);

  if (mpiPi.global_task_app_time != NULL)
    free (mpiPi.global_task_app_time);

  if (mpiPi.global_task_mpi_time != NULL)
    free (mpiPi.global_task_mpi_time);

  if (mpiPi.global_task_hostnames != NULL)
    free (mpiPi.global_task_hostnames);

  if (mpiPi.task_pt2pt_stats)
    {
      h_close(mpiPi.task_pt2pt_stats);
    }

  /*  Could do a lot of housekeeping before calling PMPI_Finalize()
   *  but is it worth the additional work?
   *  For instance:
   h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av);
   for (i = 0; (i < 20) && (i < ac); i++)
   {
   if (av[i]->siteData != NULL )
   free (av[i]->siteData);
   }
   */

  return;
}
void serveur_appli(char *service, char *protocole)

/* Procedure correspondant au traitemnt du serveur de votre application */

{

/* A completer ... */
struct sockaddr_in adr_interne;
int taille=100, lg_message=100, num_socket;
char *message;
struct sockaddr_in adr_distante;
message=(char*)malloc(taille* sizeof(char));
num_socket=h_socket(AF_INET,SOCK_DGRAM);
adr_socket(service,"localhost","udp",&adr_interne, SERVEUR);
h_bind(num_socket,&adr_interne);
for(;;)
 {
  lg_message=h_recvfrom(num_socket, message, taille, &adr_distante); 
		  printf("%d %s\n",lg_message,message);
  h_sendto(num_socket, message, lg_message, &adr_distante);
 }
h_close(num_socket);
}
void serveur_fermer_client(int clientfd){
	h_close (clientfd);
}