add tcp support for rpc_ping

This commit is contained in:
Doug MacEachern 2006-02-27 16:49:15 +00:00
parent 9f1fa65239
commit 141ff23dcb

View File

@ -536,8 +536,21 @@ SIGAR_DECLARE(int) sigar_rpc_ping(char *host,
interval.tv_usec = 0; interval.tv_usec = 0;
addr.sin_port = htons(port); addr.sin_port = htons(port);
sock = RPC_ANYSOCK; 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) { if (!client) {
return rpc_createerr.cf_stat; return rpc_createerr.cf_stat;
} }