From 141ff23dcb708abc9908b1097831c7c7b9d6cdba Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 27 Feb 2006 16:49:15 +0000 Subject: [PATCH] add tcp support for rpc_ping --- src/sigar_util.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/sigar_util.c b/src/sigar_util.c index fc39dcc0..c2dc256d 100644 --- a/src/sigar_util.c +++ b/src/sigar_util.c @@ -536,8 +536,21 @@ SIGAR_DECLARE(int) sigar_rpc_ping(char *host, interval.tv_usec = 0; addr.sin_port = htons(port); sock = RPC_ANYSOCK; - client = clntudp_create(&addr, program, version, - interval, &sock); + + if (protocol == SIGAR_NETCONN_UDP) { + client = + clntudp_create(&addr, program, version, + interval, &sock); + } + else if (protocol == SIGAR_NETCONN_TCP) { + client = + clnttcp_create(&addr, program, version, + &sock, 0, 0); + } + else { + return RPC_UNKNOWNPROTO; + } + if (!client) { return rpc_createerr.cf_stat; }