//--------------------------------------------------------------------------- // Public Methods //--------------------------------------------------------------------------- int RunClientServerTest() { int ret; printf("Starting Client/Server test...\n\n"); // Print out menu printf("Is this the client or server?\n"); printf("Server = 0\n"); printf("Client = 1\n"); // Get input from user char input; scanf("%c%*c", &input); switch(input) { case '0': ret = RunServer(); break; case '1': ret = RunClient(); break; default: assert(false); break; } return ret; }
void CUIManager::OpeningUI() { while (1) { int m = MainMenu(); switch (m) { case 1: // single player game gpGame->RunSingleGame(); break; case 2: // multiplayer game #if 0 m = NetGameMenu(); if (m == 1) { gpGame->RunNetGame(); } else if (m == 2) { RunClient(cfg.Get("GAME", "HostName", ""), cfg.Get("GAME", "PlayerName", "Player"), cfg.Get("GAME", "ServerPwd", "")); } #endif break; case 3: // options Options(); break; } } }
bool NetworkTest::Run(int argc, char** argv) { QString arg2; if(argc > 2) arg2 = argv[2]; if(arg2 != "server" && arg2 != "client") { std::cerr << "Usage: ./test_framework Network < server | client >" << std::endl; return false; } dt::Root& root = dt::Root::GetInstance(); root.Initialize(argc, argv); // register event prototype std::shared_ptr<dt::NetworkEvent> ptr(new CustomNetworkEvent(0, CustomNetworkEvent::CLIENT)); root.GetNetworkManager()->RegisterNetworkEventPrototype(ptr); bool result = false; if(arg2.toLower() == "server") { result = RunServer(); } else if(arg2.toLower() == "client") { result = RunClient(); } else { std::cerr << "This should not happen." << std::endl; result = false; } root.Deinitialize(); return result; }
int main() { unsigned short port = 1337; string selection; string p; string ip = "localhost"; cout << "NETWORK TEST - CLIENT-SERVER" << endl; cout << "Wanna launch a client (c) or a server (s) ?" << endl; getline(cin, selection); cout << "Which port ?" << endl; getline(cin, p); port = atoi(p.c_str()); if(selection == "s") { RunServer(port); } else { cout << "Which IP?" << endl; getline(cin, ip); cout << "Connecting to " << ip << ":" << port << endl; RunClient(ip, port); } }
int main() { unsigned short port = 1337; char selection; string ip = "localhost"; cout << "NETWORK TEST - CLIENT-SERVER" << endl; cout << "Wanna launch a client (c) or a server (s) ?" << endl; cin >> selection; cout << "Which port ?" << endl; cin >> port; if(selection == 's') { RunServer(port); } else { cout << "Which IP?" << endl; cin >> ip; cout << "Connecting to " << ip << ":" << port << endl; RunClient(ip, port); } }
void Application::Menu_select() { y -= 3; switch(y) { case 1: RunClient(); Client_select(); break; case 2: RunAdmin(); Admin_select(); CW.DeleteCW(); break; case 3: OpenOutputFile(); PutClientListToFile(); exit(100); } }
BOOL CBetaPatchClientApp::InitInstance() { AfxEnableControlContainer(); #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif BOOL bSkipPatch = FALSE; CHECK_TYPE type = CheckSingleInstance(); switch( type ) { case CHECK_FALSE: return FALSE; case CHECK_SKIP: RunClient(); return FALSE; } ::DeleteFile( PATCH_LOGFILE ); ::DeleteFile( "NewFlyff.exe" ); if( InitPath() == FALSE ) // 레지스트리에서 실행 Path를 얻어 지정한다. return FALSE; if( CheckDirectXVersion() == FALSE ) { AfxMessageBox( IDS_DIRECTX_INSTALL ); // DirectX 9가 설치되어 있지 않습니다. return FALSE; } CBetaPatchClientDlg dlg; m_pMainWnd = &dlg; g_pDlg = &dlg; dlg.DoModal(); return FALSE; }
int main(int argc, char* argv[]) { std::cout << "Program Usage:\n"; std::cout << argv[0] << " <0 = server, 1,2,..254 = client>\n"; if(argc > 1) { if(atoi(argv[1]) == 0) { return RunServer(); } else { return RunClient(gSubsystemID, (JAUS::Byte)(atoi(argv[1])) + 1); } } else { // Default return RunServer(); } return 0; }
int _tmain(int argc, char* argv[]) { char c; bool bRunClient = false; char szPipeTemp[51]; int nStartParams = 2; memset(g_szPipeName, 0, MAX_PATH + 1); memset(szPipeTemp, 0, 51); if (argc > 1) { if (strcmp(argv[1], "/?") == 0) { Usage(); return -1; } while ((c = getopt(argc, argv, _T("scn:"))) != EOF) { switch(c) { case 's': bRunClient = false; break; case 'c': bRunClient = true; break; case 'n': if (strlen(optarg) > MAX_PATH) { printf("WARNING: Pipe name is greater than MAX_PATH characters, name may be truncated\n"); } strncpy_s(szPipeTemp, 51, optarg, 50); nStartParams += 2; // move start parameters out by 2 break; default: printf("Ignoring unknown option '%c'\n", c); break; } } if (strlen(szPipeTemp) <= 0) { // Use a default pipe name strncpy_s(szPipeTemp, 51, DEFAULT_PIPE, 50); } } else { Usage(); return -1; } if (!bRunClient) { _snprintf_s(g_szPipeName, MAX_PATH, strlen(PIPE_FORMAT)-2+1+strlen(szPipeTemp), PIPE_FORMAT, ".", szPipeTemp); // Do the service thing SERVICE_TABLE_ENTRY svcTable[] = { { _T(SERVICE_NAME), ServiceMain }, { NULL, NULL } }; if (!StartServiceCtrlDispatcher(svcTable)) return -1; return 0; } else { _snprintf_s(g_szPipeName, MAX_PATH, strlen(PIPE_FORMAT)-2+strlen(argv[nStartParams])+strlen(szPipeTemp), PIPE_FORMAT, argv[nStartParams], szPipeTemp); if ((argc - nStartParams) > 2) // Have parameters to pass to the exe to run { char szParams[MAX_PATH]; ::ZeroMemory(szParams, MAX_PATH); for (int i = nStartParams + 2; i < argc; i++) { strcat_s(szParams, MAX_PATH, " "); strcat_s(szParams, MAX_PATH, (char*)argv[i]); } return RunClient(argv[nStartParams], argv[nStartParams + 1], szParams); } else return RunClient(argv[nStartParams], argv[nStartParams + 1], NULL); } }