• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setCmdStr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setCmdStr函数的典型用法代码示例。如果您正苦于以下问题:C++ setCmdStr函数的具体用法?C++ setCmdStr怎么用?C++ setCmdStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setCmdStr函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setCmdStr

bool
DCStartd::requestClaim( ClaimType cType, const ClassAd* req_ad, 
						ClassAd* reply, int timeout )
{
	setCmdStr( "requestClaim" );

	std::string err_msg;
	switch( cType ) {
	case CLAIM_COD:
	case CLAIM_OPPORTUNISTIC:
		break;
	default:
		err_msg = "Invalid ClaimType (";
		err_msg += (int)cType;
		err_msg += ')';
		newError( CA_INVALID_REQUEST, err_msg.c_str() );
		return false;
	}

	ClassAd req( *req_ad );
	char buf[1024]; 

		// Add our own attributes to the request ad we're sending
	sprintf( buf, "%s = \"%s\"", ATTR_COMMAND,
			 getCommandString(CA_REQUEST_CLAIM) );
	req.Insert( buf );

	sprintf( buf, "%s = \"%s\"", ATTR_CLAIM_TYPE, getClaimTypeString(cType) );
	req.Insert( buf );

	return sendCACmd( &req, reply, true, timeout );
}
开发者ID:zzxuanyuan,项目名称:htcondor,代码行数:32,代码来源:dc_startd.cpp


示例2: isend

/*
如何使用此对像:
1、构造对像
	isend("dddd");
2、发送数据:
	trigerSend("dddd"); //这个dddd表示要发送出去的完整内容。注意不是关键字
	如果不管结果的话,到此就OK了
3、如果要看最后发送的情况,就要设置一个for语句:
*step 1
       psender->trigerSend(dat);
       for(;;) {
*step 2
               ret = psender->isResultOk();
               if (ret == 1) {
                       printf("send datas ok:");
*step 3
                        break;
                } else if (ret == 2) {
                        printf("send datas fail\n");
                        break;
                } else {
                        usleep(100000);
                }
       }

2、设置要发送的命令字符串
3、在远程返回结果的地方加入自己的代码

*/
ISend::ISend(const char *cmdstr, void (*cb)(unsigned char *dat, unsigned char len))
{
	trys = 0;
	_type = 0;
	setStatus(S_I);
	setSendResult(RLT_INIT);
	clearAckData();
	setCmdStr(cmdstr);
	_keywordlen = strlen(cmdstr);
	_cb = cb;
	creat_send_thread();
}
开发者ID:chendong2012,项目名称:cells,代码行数:41,代码来源:ISend.cpp


示例3: dprintf

bool 
DCStartd::checkpointJob( const char* name_ckpt )
{
	dprintf( D_FULLDEBUG, "Entering DCStartd::checkpointJob(%s)\n",
			 name_ckpt );

	setCmdStr( "checkpointJob" );

	if (IsDebugLevel(D_COMMAND)) {
		int cmd = PCKPT_JOB;
		dprintf (D_COMMAND, "DCStartd::checkpointJob(%s,...) making connection to %s\n", getCommandStringSafe(cmd), _addr ? _addr : "NULL");
	}

	bool  result;
	ReliSock reli_sock;
	reli_sock.timeout(20);   // years of research... :)
	if( ! reli_sock.connect(_addr) ) {
		std::string err = "DCStartd::checkpointJob: ";
		err += "Failed to connect to startd (";
		err += _addr ? _addr : "NULL";
		err += ')';
		newError( CA_CONNECT_FAILED, err.c_str() );
		return false;
	}

	int cmd = PCKPT_JOB;

	result = startCommand( cmd, (Sock*)&reli_sock ); 
	if( ! result ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send command PCKPT_JOB to the startd" );
		return false;
	}

		// Now, send the name
	if( ! reli_sock.put(name_ckpt) ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send Name to the startd" );
		return false;
	}
	if( ! reli_sock.end_of_message() ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send EOM to the startd" );
		return false;
	}
		// we're done
	dprintf( D_FULLDEBUG, "DCStartd::checkpointJob: "
			 "successfully sent command\n" );
	return true;
}
开发者ID:zzxuanyuan,项目名称:htcondor,代码行数:50,代码来源:dc_startd.cpp


示例4: clearReceiveData

unsigned char ISend::trigerSend(unsigned char *s)
{
        if (status == S_I) {
                clearReceiveData();
                setCmdStr(s);
                status = S_S;
                setindex();
                setSendResult(RLT_INIT);

                sendRfDatas();
                return 1;
        } else {
                return 0;
        }
}
开发者ID:chendong2012,项目名称:cells,代码行数:15,代码来源:ISend.cpp


示例5: dprintf

bool 
DCStartd::checkpointJob( const char* name_ckpt )
{
	dprintf( D_FULLDEBUG, "Entering DCStartd::checkpointJob(%s)\n",
			 name_ckpt );

	setCmdStr( "checkpointJob" );

	bool  result;
	ReliSock reli_sock;
	reli_sock.timeout(20);   // years of research... :)
	if( ! reli_sock.connect(_addr) ) {
		std::string err = "DCStartd::checkpointJob: ";
		err += "Failed to connect to startd (";
		err += _addr;
		err += ')';
		newError( CA_CONNECT_FAILED, err.c_str() );
		return false;
	}

	int cmd = PCKPT_JOB;

	result = startCommand( cmd, (Sock*)&reli_sock ); 
	if( ! result ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send command PCKPT_JOB to the startd" );
		return false;
	}

		// Now, send the name
	if( ! reli_sock.code((unsigned char *)const_cast<char*>(name_ckpt)) ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send Name to the startd" );
		return false;
	}
	if( ! reli_sock.end_of_message() ) {
		newError( CA_COMMUNICATION_ERROR,
				  "DCStartd::checkpointJob: Failed to send EOM to the startd" );
		return false;
	}
		// we're done
	dprintf( D_FULLDEBUG, "DCStartd::checkpointJob: "
			 "successfully sent command\n" );
	return true;
}
开发者ID:AmesianX,项目名称:htcondor,代码行数:45,代码来源:dc_startd.cpp


示例6: setCmdStr

bool
DCStarter::reconnect( ClassAd* req, ClassAd* reply, ReliSock* rsock,
					  int timeout, char const *sec_session_id )
{
	setCmdStr( "reconnectJob" );

	std::string line;

		// Add our own attributes to the request ad we're sending
	line = ATTR_COMMAND;
	line += "=\"";
	line += getCommandString( CA_RECONNECT_JOB );
	line += '"';
	req->Insert( line.c_str() );

	return sendCACmd( req, reply, rsock, false, timeout, sec_session_id );
	

}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:19,代码来源:dc_starter.cpp


示例7: clearAckData

unsigned char ISend::trigerSend(const char *s)
{
        if (getStatus() == S_I) {
		clearAckData();
                setCmdStr(s);
		setStatus(S_S);

                setindex();
                setSendResult(RLT_INIT);

		if (_type == 1) {
			setStatus(S_I);
			setSendResult(RLT_OK);
		}
                sendRfDatas();
                return 1;
        } else {
                return 0;
        }
}
开发者ID:chendong2012,项目名称:cells,代码行数:20,代码来源:ISend.cpp



注:本文中的setCmdStr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setCodeInvalidated函数代码示例发布时间:2022-05-30
下一篇:
C++ setClient函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap