本文整理汇总了C++中Sock::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Sock::get方法的具体用法?C++ Sock::get怎么用?C++ Sock::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sock
的用法示例。
在下文中一共展示了Sock::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char *argv[] )
{
const char *filename=0;
char *pool=0;
int command=-1;
int i;
bool use_tcp = false;
bool with_ack = false;
bool allow_multiple = false;
param_functions *p_funcs = NULL;
myDistro->Init( argc, argv );
config();
p_funcs = get_param_functions();
for( i=1; i<argc; i++ ) {
if(!strcmp(argv[i],"-help")) {
usage(argv[0]);
exit(0);
} else if(!strcmp(argv[i],"-pool")) {
i++;
if(!argv[i]) {
fprintf(stderr,"-pool requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
pool = argv[i];
} else if(!strncmp(argv[i],"-tcp",strlen(argv[i]))) {
use_tcp = true;
} else if(!strncmp(argv[i],"-multiple",strlen(argv[i]))) {
// We don't set allow_multiple=true by default, because
// existing users (e.g. glideinWMS) have stray blank lines
// in the input file.
allow_multiple = true;
} else if(!strcmp(argv[i],"-version")) {
version();
exit(0);
} else if(!strcmp(argv[i],"-debug")) {
// dprintf to console
Termlog = 1;
p_funcs = get_param_functions();
dprintf_config ("TOOL", p_funcs);
} else if(argv[i][0]!='-' || !strcmp(argv[i],"-")) {
if(command==-1) {
command = getCollectorCommandNum(argv[i]);
if(command==-1) {
fprintf(stderr,"Unknown command name %s\n\n",argv[i]);
usage(argv[0]);
exit(1);
}
} else if(!filename) {
filename = argv[i];
} else {
fprintf(stderr,"Extra argument: %s\n\n",argv[i]);
usage(argv[0]);
exit(1);
}
} else {
fprintf(stderr,"Unknown argument: %s\n\n",argv[i]);
usage(argv[0]);
exit(1);
}
}
FILE *file;
ClassAdList ads;
Daemon *collector;
Sock *sock;
switch( command ) {
case UPDATE_STARTD_AD_WITH_ACK:
with_ack = true;
break;
}
if( with_ack ) {
use_tcp = true;
}
if(!filename || !strcmp(filename,"-")) {
file = stdin;
filename = "(stdin)";
} else {
file = safe_fopen_wrapper_follow(filename,"r");
}
if(!file) {
fprintf(stderr,"couldn't open %s: %s\n",filename,strerror(errno));
return 1;
}
while(!feof(file)) {
int eof=0,error=0,empty=0;
char const *delim = "\n";
if( !allow_multiple ) {
delim = "***";
}
ClassAd *ad = new ClassAd(file,const_cast<char *>(delim),eof,error,empty);
if(error) {
fprintf(stderr,"couldn't parse ClassAd in %s\n",filename);
//.........这里部分代码省略.........