2 * Copyright (C) 2010 Brian Aker
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
8 * Summary: connects to a host, and makes sure it is alive.
12 #include "libmemcached/common.h"
13 #include "libmemcached/memcached_util.h"
16 bool libmemcached_util_ping(const char *hostname
, in_port_t port
, memcached_return_t
*ret
)
18 memcached_return_t rc
;
19 memcached_st memc
, *memc_ptr
;
21 memc_ptr
= memcached_create(&memc
);
23 rc
= memcached_server_add(memc_ptr
, hostname
, port
);
25 if (rc
== MEMCACHED_SUCCESS
)
27 rc
= memcached_version(memc_ptr
);
30 memcached_free(memc_ptr
);
37 return rc
== MEMCACHED_SUCCESS
;