Hi guys: I want to get the workers' status, but I don't know which function can do it in C. Who can tell me how to get it by the lib of gearmand. Thanks very much.
On Wed, Mar 28, 2012 at 7:58 PM, auror.cao <auror.cao.ch...@gmail.com> wrote: > Hi guys: > I want to get the workers' status, but I don't know which function > can do it in C. > Who can tell me how to get it by the lib of gearmand. > Thanks very much.
Thanks for Herman Radtke's help. I found the source code in instance.cc. My solution as bellow: int _sockfd; struct addrinfo ai; struct addrinfo *_addrinfo ; char buffer[2048]={'\0'}; bzero(&ai,sizeof(ai)); ai.ai_socktype= SOCK_STREAM; ai.ai_protocol= IPPROTO_TCP;
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);
-----邮件原件----- 发件人: gearman@googlegroups.com [mailto:gearman@googlegroups.com] 代表 Herman Radtke 发送时间: 2012年3月30日 9:38 收件人: gearman@googlegroups.com 主题: Re: how to get gearmand worker list?
On Wed, Mar 28, 2012 at 7:58 PM, auror.cao <auror.cao.ch...@gmail.com> wrote: > Hi guys: > I want to get the workers' status, but I don't know which function > can do it in C. > Who can tell me how to get it by the lib of gearmand. > Thanks very much.
Look for the section with the heading "Administrative Protocol".
-----Original Message----- From: Herman Radtke Sent: Thu, 29 Mar 2012 18:38:15 -0700 To: gearman Subject: Re: how to get gearmand worker list?
On Wed, Mar 28, 2012 at 7:58 PM, auror.cao<auror.cao.ch...@gmail.com> wrote:
> Hi guys: > I want to get the workers' status, but I don't know which function > can do it in C. > Who can tell me how to get it by the lib of gearmand. > Thanks very much.
> Hi guys: > I want to get the workers' status, but I don't know which function > can do it in C. > Who can tell me how to get it by the lib of gearmand. > Thanks very much.