Beispiel #1
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  ACE_LOG_MSG->priority_mask(LM_TRACE     |
                             LM_DEBUG     |
                             LM_INFO      |
                             LM_NOTICE    |
                             LM_WARNING   |
                             LM_ERROR     |
                             LM_CRITICAL  |
                             LM_ALERT     |
                             LM_EMERGENCY,
                             ACE_Log_Msg::PROCESS);


  ClientApp app;

  try
  {
    int ret = app.run(argc,argv);
    return ret == 1 ? 0 : ret;
  }
  catch (const CORBA::Exception& ex)
  {
     ex._tao_print_exception ("Caught exception:");
  }
  catch (...)
  {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Unknown (...) exception caught in main() "
               "for ClientApp\n"));
  }

  return 1;
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    int ret = 0;
    if (argc != 2)
    {
        ret = -1;
        return ret;
    }
    if (0 == strcmp(argv[1], "-hello"))
    {
        hello();
        fprintf(stdout, "\n");
        help();
        return ret;
    }
    welcome();
    // 1.load cmd, generate addres and output packet
    char *path = argv[1];
    ClientApp app;
    Dispatcher dispatcher;
    Net_Session *session = app.get_session();
    dispatcher.set_session(session);
    ret = load_cfg(path, dispatcher);
    LOG(INFO)("load config file done. ret=%d", ret);
    if (0 != ret)
    {
        fprintf(stderr, "error!!!\n");
        return 0;
    }

    // 2.open server session
    app.open();
    LOG(INFO)("init and open mobi server done.");

    // 3.start send packet thread
    dispatcher.start();
    LOG(INFO)("start send packet thread.");

    // 4.loop event
    LOG(INFO)("enter loop, begin...");
    app.run_service();
    LOG(INFO)("done.");
    
    //app.send_packet(outpkg);
    goodbye();

    return ret;
}
Beispiel #3
0
int main(int argc, char **argv) {
	ClientApp app;
	NGetOpt<ClientApp> opts(argc, argv, &app, 1);
	
	setup_opts(&opts);
	
	try {
		if (opts.proccess()) {
			app.run();
		}
	}
	catch (NException &e) {
		NWarning::print() << "Error: " << e.getDescription();
		exit(1);
	}
	
	return 0;
}
Beispiel #4
0
		int main(int argc, char *argv[])
#endif
		{
			signal( SIGKILL, kill_sig );
			signal( SIGTERM, kill_sig );
			signal( SIGINT,  kill_sig );

			ClientApp *app = ClientApp::getInstance();

			try {
				app->go();
			} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
				MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
				std::cerr << "An exception has occured: " <<
					e.getFullDescription().c_str() << std::endl;
#endif
			}

			return 0;
		}
Beispiel #5
0
int
main(int argc, char* argv[])
{
#ifdef ICE_STATIC_LIBS
    Ice::registerIceSSL(false);
    Ice::registerIceWS(true);
#endif

#ifndef _WIN32
//
// Set SIGPIPE action
//
    struct sigaction action;
    action.sa_handler = &testAction;
    sigemptyset(&action.sa_mask);
    action.sa_flags = 0;
    sigaction(SIGPIPE, &action, 0);
#endif

    ClientApp app;
#if defined(__APPLE__) || defined(ICE_OS_UWP)
    int result = app._main(argc, argv);
#else
    int result = app.main(argc, argv);
#endif

#ifndef _WIN32
//
// Check SIGPIPE was properly reset to old action
//
    struct sigaction newAction;
    sigaction(SIGPIPE, 0, &newAction);
    test(action.sa_handler == &testAction);
#endif

    return result;
}