本文整理汇总了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;未经允许,请勿转载。 |
请发表评论