本文整理汇总了C++中run_server函数的典型用法代码示例。如果您正苦于以下问题:C++ run_server函数的具体用法?C++ run_server怎么用?C++ run_server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_server函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ndn_rtt
int ndn_rtt(int argc, char **argv)
{
if (argc < 2) {
printf("usage: %s [client|server]\n", argv[0]);
return 1;
}
if (strcmp(argv[1], "client") == 0) {
if (argc < 3) {
printf("usage: %s client _max_count_\n", argv[0]);
return 1;
}
int max_cnt = atoi(argv[2]);
if (max_cnt == 0) {
printf("invalid max count number: %s\n", argv[3]);
return 1;
}
run_client(max_cnt);
}
else if (strcmp(argv[1], "server") == 0) {
if (argc < 4) {
printf("usage: %s server _sig_type_ _content_size_\n", argv[0]);
return 1;
}
int content_sz = atoi(argv[3]);
if (content_sz <= 0 || content_sz > 200) {
printf("invalid content size: %s; will set to 4\n", argv[3]);
content_sz = 4;
}
if (strcmp(argv[2], "hmac") == 0) {
run_server(NDN_SIG_TYPE_HMAC_SHA256, content_sz);
}
else if (strcmp(argv[2], "ecdsa") == 0) {
run_server(NDN_SIG_TYPE_ECDSA_SHA256, content_sz);
}
else {
printf("unknown signature type: %s\n", argv[2]);
return 1;
}
}
else {
puts("error: invalid command");
}
return 0;
}
开发者ID:named-data-iot,项目名称:ndn-riot-examples,代码行数:49,代码来源:ndn_rtt.c
示例2: Argument_main
int Argument_main(Argument *arg){
gint port, max_connections, verbosity;
gchar *input_path;
gboolean preload;
register ArgumentSet *as = ArgumentSet_create("Exonerate Server options");
ArgumentSet_add_option(as, '\0', "port", "port",
"Port number to run server on", "12886",
Argument_parse_int, &port);
ArgumentSet_add_option(as, '\0', "input", "path",
"Path to input file (.esd or .esi)", NULL,
Argument_parse_string, &input_path);
ArgumentSet_add_option(as, '\0', "preload", NULL,
"Preload index and sequence data", "TRUE",
Argument_parse_boolean, &preload);
ArgumentSet_add_option(as, '\0', "maxconnections", "threads",
"Maximum concurrent server connections", "4",
Argument_parse_int, &max_connections);
ArgumentSet_add_option(as, 'V', "verbosity", "level",
"Set server verbosity level", "1",
Argument_parse_int, &verbosity);
Argument_absorb_ArgumentSet(arg, as);
/**/
Match_ArgumentSet_create(arg);
HSPset_ArgumentSet_create(arg);
/**/
Argument_process(arg, "exonerate-server", "Exonerate Server.\n",
"Guy St.C. Slater. [email protected] June 2006\n");
run_server(port, input_path, preload, max_connections, verbosity);
g_message("-- server exiting");
return 0;
}
开发者ID:b-brankovics,项目名称:grabb,代码行数:31,代码来源:exonerate-server.c
示例3: main
int main(int argc, char **argv)
{
if (argc > 1 && strcmp(argv[1], "test") == 0)
return run_tests(argc, argv);
return run_server(argc, argv);
}
开发者ID:alexeyvo,项目名称:memcached_analog,代码行数:7,代码来源:main.cpp
示例4: main
int main()
{
int * pipe_req = pipe_create();
int * pipe_ans = pipe_create();
pid_t fork_res = fork();
switch(fork_res)
{
case -1: printf("Stopped. Fork error.\n");
break;
case 0: close(pipe_req[1]);
close(pipe_ans[0]);
run_server(pipe_req[0], pipe_ans[1]);
close(pipe_req[0]);
close(pipe_ans[1]);
break;
default: close(pipe_req[0]);
close(pipe_ans[1]);
run_client(pipe_req[1], pipe_ans[0]);
close(pipe_req[1]);
close(pipe_ans[0]);
break;
};
pipe_delete(pipe_req);
pipe_delete(pipe_ans);
return 0;
}
开发者ID:rakhimovv,项目名称:mipt-informatics,代码行数:29,代码来源:Pipe.c
示例5: run_server
void run_server_or_cgi::run()
{
bool server=false;
for (int i=1; i<argc; i++)
if (argv[i]==string("-s")||
argv[i]==string("--server"))
server=true;
if (server){
run_server(c, argc, argv).run();
}
else{
bool help=false;
for (int i=1; i<argc; i++)
if (argv[i]==string("-h")||
argv[i]==string("--help"))
help=true;
if (help){
cerr<<"usage: "<<argv[0]<<" [-s] [-h] [server-options]"<<endl;
exit(0);
}
run_cgi(c).run();
}
}
开发者ID:b-xiang,项目名称:pficommon,代码行数:26,代码来源:server.cpp
示例6: wait_thread
void* wait_thread(void* args)
{
int status;
while(running_flag) {
//Start server
pthread_mutex_lock(&fd_mutex);
server_pid = run_server();
if(server_pid == -1) {
pthread_mutex_unlock(&fd_mutex);
printlog(LOG_SERVER, "Failed to run server!\n");
continue;
}
pthread_mutex_unlock(&fd_mutex);
printlog(LOG_SERVER, "Server started.\n");
//Wait
waitpid(server_pid, &status, 0);
}
UNREFERRED_PARAMETER(args);
return NULL;
}
开发者ID:darknightghost,项目名称:mcserverd,代码行数:25,代码来源:game-server.c
示例7: main
int
main(int argc, char **argv)
{
int loop_number = 0;
startup_win_network();
parse_parameters(argc, argv);
init_network();
signal(SIGINT, sig_handler);
if (!quiet)
{
fprintf(stderr, "listening on port %d for packets .... \n", port_num);
if (continuous)
fprintf(stderr, "looping tests.\n");
fprintf(stderr, "\n");
}
fprintf(stdout, "# run no., loss rate in %%, packets_sent, packets_received, payload_size\n");
do
{
loop_number++;
fprintf(stdout, "%2d. ", loop_number);
run_server();
}
while (continuous);
return 1;
}
开发者ID:flypenguin,项目名称:archive-dbsniff,代码行数:32,代码来源:loss_srv.c
示例8: main
int main(int argc, char *argv[]){
int server;
int port = DEFAULT_PORT;
int c;
opterr = 0;
while ((c = getopt (argc, argv, "sp:")) != -1){
switch (c){
case 's':
server = 1;
break;
case 'p':
port = atoi(optarg);
break;
default:
fprintf(stderr, "undefined argument\n");
exit(1);
}
}
if (server){
run_server(port);
} else {
run_client(port);
}
return 0;
}
开发者ID:millerjs,项目名称:pentago,代码行数:32,代码来源:pentago.cpp
示例9: _tmain
int _tmain(int argc, TCHAR *argv[])
{
int res = 0;
program_state_t state;
if (argc != 4) {
_tprintf(_T("Usage: %s <port> <in folder> <num of threads>\n"), argv[0]);
return -1;
}
state.port = _tstoi(argv[1]);
_tcscpy_s(state.in_dir, argv[2]);
state.num_of_threads = _tstoi(argv[3]);
if (!init_state(&state)) {
res = -1;
goto cleanup;
}
if (!run_server(&state)) {
res = -1;
}
cleanup:
if (!fini_state(&state)) {
res = -1;
}
return res;
}
开发者ID:KWMalik,项目名称:tau,代码行数:27,代码来源:http_srv.cpp
示例10: server
int server(struct conf *conf, const char *conffile,
struct lock *lock, int generate_ca_only)
{
int ret=0;
int rfd=-1; // normal client port
// Only close and reopen listening sockets if the ports changed.
// Otherwise you get an "unable to bind listening socket on port X"
// error, and the server stops.
char *oldport=NULL;
char *oldstatusport=NULL;
//return champ_test(conf);
if(ca_server_setup(conf)) return 1;
if(generate_ca_only)
{
logp("The '-g' command line option was given. Exiting now.\n");
return 0;
}
if(conf->forking && conf->daemon)
{
if(daemonise() || relock(lock)) return 1;
}
ssl_load_globals();
while(!ret && !gentleshutdown)
{
ret=run_server(conf, conffile,
&rfd, oldport, oldstatusport);
if(ret) break;
if(hupreload && !gentleshutdown)
{
if(oldport) free(oldport);
if(oldstatusport) free(oldstatusport);
oldport=strdup(conf->port);
oldstatusport=conf->status_port?
strdup(conf->status_port):NULL;
if(reload(conf, conffile,
0, // Not first time.
conf->max_children,
conf->max_status_children,
0)) // Not JSON output.
ret=1;
}
hupreload=0;
}
close_fd(&rfd);
close_fd(&sfd);
if(oldport) free(oldport);
if(oldstatusport) free(oldstatusport);
// The signal handler stuff sets up chlds. Need to free them.
chlds_free();
// FIX THIS: Have an enum for a return value, so that it is more obvious what
// is happening, like client.c does.
return ret;
}
开发者ID:Kalimeiro,项目名称:burp,代码行数:60,代码来源:main.c
示例11: main
int
main(int argc, char *argv[])
{
in_port_t port;
uint8_t page_count;
if (argc > 3) {
printf("Too many arguments\n");
return -1;
}
if (argc < 3) {
printf("Not enough arguments (port, pages)\n");
return -1;
}
if (sscanf(argv[1], "%"SCNu16, &port) != 1) {
printf("Bad port\n");
return -1;
}
if (sscanf(argv[2], "%"SCNu8, &page_count) != 1) {
printf("Bad page number\n");
return -1;
}
return run_server(port, page_count, xen_shm_handler_ping_server, NULL);
}
开发者ID:Feandil,项目名称:xen_shm,代码行数:28,代码来源:ping_server.c
示例12: main
int main(int argc, const char **argv)
{
clioptions opts;
parse_commandline(argc, argv, &opts);
run_server(&opts);
return 0;
}
开发者ID:LlsDimple,项目名称:latency-benchmark,代码行数:7,代码来源:main.c
示例13: main
int main(char argc, char *argv[]){
if( args_handle(argc,argv) != -1 ){
run_server(OPTION_PORT);
}
return 0;
}
开发者ID:af-inet,项目名称:Http-Server-C,代码行数:8,代码来源:main.c
示例14: ServiceMain
void CALLBACK ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv)
{
int seq=1;
HKEY hk;
DWORD dwTmp,dwType;
char szTmp[1024];
HANDLE hSem = CreateSemaphore(NULL,0,1,"CVSNT_ControlPanel");
if(dwArgc!=999)
{
if (!(g_hService = RegisterServiceCtrlHandler(SERVICE_NAME,ServiceHandler))) { ReportError(TRUE,"Unable to start "SERVICE_NAME" - RegisterServiceCtrlHandler failed"); return; }
NotifySCM(SERVICE_START_PENDING, 0, seq++);
}
else
{
g_bTestMode=TRUE;
printf(SERVICE_NAME" " CVSNT_PRODUCTVERSION_STRING " ("__DATE__") starting in test mode.\n");
}
// Initialisation
WSADATA data;
if(WSAStartup (MAKEWORD (1, 1), &data))
{
ReportError(TRUE,"WSAStartup failed... aborting - Error %d\n",WSAGetLastError());
if(!g_bTestMode)
NotifySCM(SERVICE_STOPPED,0,0);
return;
}
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\CVS\\Pserver",NULL,KEY_QUERY_VALUE,&hk))
{
dwTmp=sizeof(szTmp);
if(!RegQueryValueEx(hk,"ControlPanel",NULL,&dwType,(BYTE*)szTmp,&dwTmp))
{
char *p = strchr(szTmp,':');
if(p)
controlserver_port=atoi(p+1);
}
dwTmp=sizeof(szTmp);
if(!RegQueryValueEx(hk,"ControlPanelLocal",NULL,&dwType,(BYTE*)szTmp,&dwTmp))
{
if(dwType==REG_DWORD)
local_only = *(DWORD*)szTmp;
}
RegCloseKey(hk);
}
run_server(controlserver_port, seq, local_only);
CloseHandle(hSem);
if(!g_bTestMode)
NotifySCM(SERVICE_STOPPED, 0, 0);
ReportError(FALSE,SERVICE_NAME" stopped successfully");
}
开发者ID:pampersrocker,项目名称:G-CVSNT,代码行数:58,代码来源:ControlService.cpp
示例15: main
/*---------------------------------------------------------------------------------------
-- FUNCTION: main
--
-- DATE: February 11, 2016
--
-- DESIGNERS: Rizwan Ahmed, Vishav Singh
--
-- PROGRAMMERS: Rizwan Ahmed, Vishav Singh
--
-- RETURNS: 0 on exit
--
-- NOTES: Main entry point of the program. Merely gets rid of the need to flush
-- everytime something is printed to standard output and calls the server loop.
---------------------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
(void)signal(SIGINT, kill_server);
setbuf(stdout, NULL);
run_server(SERVER_PORT);
return 0;
}
开发者ID:vsingh27,项目名称:scalable_server,代码行数:23,代码来源:select_server.cpp
示例16: main
int main(int argc, char *argv[]) {
char **p_ptr = NULL;
char *config_file = NULL;
int port = GAMED_PORT;
int c, fork = 1;
long requested_port = 0;
struct rlimit limit;
while ((c = getopt (argc, argv, "Xp:f:")) != -1) {
switch(c) {
case 'X':
fork = 0;
break;
case 'p':
requested_port = strtol(optarg, p_ptr, 10);
if (p_ptr != NULL || requested_port > 65535) {
printf("%s is not a valid port\n", optarg);
return 1;
}
port = requested_port;
break;
case 'f':
case '?':
if (optopt == 'p') {
/* getopt is printing errors for me, so this isn't needed
fprintf(stderr, "No port specified with -p\n");
*/
}
else {
fprintf(stderr, "Usage: [-X] [-p port] [-f /path/to/config]\n");
}
return 1;
default:
abort();
}
}
limit.rlim_cur = RLIM_INFINITY;
limit.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_CORE, &limit);
if (fork) {
if (daemon(1, 0) == -1) {
perror("daemonize");
return 1;
}
}
if (config_file == NULL) {
init_server(port, DEFAULT_CONFIG);
}
else {
init_server(port, config_file);
}
free(config_file);
run_server();
return 0;
}
开发者ID:bpa,项目名称:gamed,代码行数:56,代码来源:main.c
示例17: reset_port
static void *thread_start(void *arg)
{
struct thread *t = arg;
reset_port(t->ai, atoi(t->opts->port), t->cb);
if (t->opts->client)
run_client(t);
else
run_server(t);
return NULL;
}
开发者ID:furen62682,项目名称:neper,代码行数:10,代码来源:tcp_rr.c
示例18: main
int main(int argc, char const* argv[])
{
if (argc > 2) {
run_client(atoi(argv[1]));
} else {
run_server(atoi(argv[1]));
}
return 0;
}
开发者ID:RichyMong,项目名称:std,代码行数:10,代码来源:epoll_et.c
示例19: main
int main(int argc, char *argv[]) {
int sock_fd;
bind_serv(&sock_fd);
start_listen(&sock_fd);
run_server(&sock_fd);
return EXIT_SUCCESS;
}
开发者ID:ben-hunter-hansen,项目名称:httpserver,代码行数:10,代码来源:main.c
示例20: main
int main(int argc, char **argv)
{ const char *tmp = getenv("TMPDIR");
if (tmp)
TMPDIR = tmp;
if (argc < 2)
return cgi_server();
if (argc < 3)
return run_server(atoi(argv[1]));
return run_client(argc, argv);
}
开发者ID:BioinformaticsArchive,项目名称:KBWS,代码行数:10,代码来源:mtom-stream-test.c
注:本文中的run_server函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论