/*
** Simple test program 00 for the MIAMI protocol
** Rolf Riesen, December 2009
**
** Usage: test_00 local_port local_host remote_host remote_port rank
** rank should be 0 in one process, and 1 in the other.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "miami.h"



int
main(int argc, char *argv[])
{

char *host1;
char *host2;
int port1, port2;
int rank;


    if (argc != 6)   {
	fprintf(stderr, "Usage: %s local_host local_port remote_host remote_port rank\n", argv[0]);
	return -1;
    }

    host1= argv[1];
    host2= argv[3];
    port1= strtol(argv[2], NULL, 10);
    port2= strtol(argv[4], NULL, 10);
    rank= strtol(argv[5], NULL, 10);

    printf("Test I'm running on host %s, rank %d and will connect to host %s, port %d\n", host1, rank, host2, port2);

    miami_init(host1, port1, host2, port2);
    printf("Test Back from miami_init()\n");
    fflush(stdout);

    miami_finalize();
    printf("Test Back from miami_finalize()\n");
    fflush(stdout);

    return 0;

}  /* end of main() */
