feat: server, client 디렉토리 조정 및 client 헤더 파일 추가. 시나리오
혹은 대화형 클라이언트로 수정
This commit is contained in:
parent
b887f15662
commit
1d103d7f16
12 changed files with 281 additions and 112 deletions
39
client/main.cpp
Normal file
39
client/main.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "Client.h"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
bool isScenario = false;
|
||||
std::string nickname;
|
||||
std::string scenarioFile;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
if (arg == "--scenario" && i + 1 < argc) {
|
||||
isScenario = true;
|
||||
scenarioFile = argv[++i];
|
||||
} else {
|
||||
nickname = arg;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
boost::asio::io_context io_context;
|
||||
if (isScenario) {
|
||||
if (scenarioFile.empty()) {
|
||||
std::cerr
|
||||
<< "시나리오 파일명이 필요합니다. 사용법: --scenario <파일경로>"
|
||||
<< std::endl;
|
||||
return 1;
|
||||
}
|
||||
ScenarioClient client(io_context, "127.0.0.1", "30000", scenarioFile);
|
||||
client.Run();
|
||||
} else {
|
||||
InteractiveClient client(io_context, "127.0.0.1", "30000");
|
||||
client.Run();
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << "Exception: " << e.what() << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue