Esempio n. 1
0
int main(int argc, char **argv)
{
	FILE *peer;

	parse_opt(argc, argv);
	is_client = !!arg_servername;

	peer = get_peer(!is_client);
	pscom_openib_init(peer);

	if (!is_client) { // server
		printf("Server\n");

		if (!arg_nokill) {
			// Kill the server with SIGSTOP if the peer disappear.
			int fd = fileno(peer);
			SCALL(fcntl(fd, F_SETOWN, getpid()));
			SCALL(fcntl(fd, F_SETSIG, SIGINT));
			SCALL(fcntl(fd, F_SETFL, O_ASYNC));
		}
		run_pp_server();
	} else {
		printf("Client\n");
		do_pp_client();
	}

	return 0;
}
Esempio n. 2
0
int main(int argc, char **argv)
{
	FILE *peer;

	parse_opt(argc, argv);

	peer = get_peer();
	init(peer);

	if (is_server) { // server
		if (!arg_nokill) {
			// Kill the server with SIGSTOP if the peer disappear.
			int fd = fileno(peer);
			SCALL(fcntl(fd, F_SETOWN, getpid()));
			SCALL(fcntl(fd, F_SETSIG, SIGINT));
			SCALL(fcntl(fd, F_SETFL, O_ASYNC));
		}
		run_pp_server();
	} else {
		sleep(2);
		do_pp_client();
	}

	return 0;
}
Esempio n. 3
0
int main(int argc, char **argv)
{
	parse_opt(argc, argv);

	init();

	if (my_rank == RANK_SERVER) { // server
		run_pp_server();
	} else if (my_rank == RANK_CLIENT) {
		do_pp_client();
	} else {
		printf("Unkown rank:%d\n", my_rank);
		exit(1);
	}

	return 0;
}