#include"pch.h"
#include"ChattingServer.h"
#include"../Utils.h"
#include<rapidjson/document.h>
ChattingServer gChattingServer;
int main()
{
std::string jsonStr = Utils::LoadFile(L"ServerInfo.json");
rapidjson::Document doc;
if (doc.Parse(jsonStr.c_str()).HasParseError()) {
std::cerr << "JSON 파싱 실패\n";
return 1;
}
std::string ipAddress = doc["ipAddress"].GetString();
int port = doc["port"].GetInt();
gChattingServer.Start(Utils::Convert(ipAddress).c_str(), port);
_setmode(_fileno(stdout), _O_U16TEXT);
while (true)
{
wcout << L"===================" << endl << endl;
wcout << L"ChattingServer" << endl << endl;
wcout << L"acceptTotal : [ " << gChattingServer._acceptTotal << " ]" << endl;
wcout << L"acceptTPS : [ " << gChattingServer._acceptTPS << " ]" << endl;
wcout << L"===================";
gChattingServer._acceptTPS = 0;
Sleep(1000);
system("cls");
}
return 0;
}
main에서 ChattingServer를 선언하고 json으로 ip와 port를 읽어와 서버를 연다.
'ChattingServer' 카테고리의 다른 글
[ChattingServer] RecvComplete ( WSARecv 통지 완료 처리 ) (0) | 2025.06.02 |
---|---|
[ChattingServer] WorkerThreadProc (0) | 2025.06.02 |
[ChattingServer] RingBuffer ( 원형 큐 ) (0) | 2025.06.01 |
[ChattingServer] AcceptThreadProc (0) | 2025.06.01 |
[ChattingServer] Session (0) | 2025.05.29 |