I don't believe there is an API call for this. You need to open a
socket to the daemon and send the commands over. Look at the source
code for gearadmin for an example:
http://bazaar.launchpad.net/~tangent-org/gearmand/trunk/view/head:/bin/gearadmin.cc
--
Herman Radtke
herman...@gmail.com | http://hermanradtke.com
int ret= getaddrinfo("127.0.0.1","4730", &ai, &_addrinfo);
if( ret)
{
printf(" getaddrinfo error");
return -1;
}
_sockfd= socket(_addrinfo->ai_family,
_addrinfo->ai_socktype,
_addrinfo->ai_protocol);
if( _sockfd <0 )
{
printf("socket error");
return -1;
}
ret = connect(_sockfd, _addrinfo->ai_addr, _addrinfo->ai_addrlen) ;
if( ret < 0 )
{
printf("connect error");
return -1;
}
ret=send(_sockfd,"status\r\n",strlen("workers\r\n"),0); //if you want to get other options just exchange the send string.
if( ret < 0 )
{
printf("send error");
return -1;
}
ret = recv(_sockfd, buffer, sizeof(buffer),0);
if( ret < 0 )
{
printf( "receive error");
return -1;
}
printf("receive data =%s",buffer);
-----邮件原件-----
发件人: gea...@googlegroups.com [mailto:gea...@googlegroups.com] 代表 Herman Radtke
发送时间: 2012年3月30日 9:38
收件人: gea...@googlegroups.com
主题: Re: how to get gearmand worker list?
http://gearman.org/index.php?id=protocol
Look for the section with the heading "Administrative Protocol".