Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
77 lines
2.3 KiB
C++
77 lines
2.3 KiB
C++
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// NetBase Class
|
|
//
|
|
// Last Update : 2002. 8. 28
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
#ifndef _NetBase
|
|
#define _NetBase
|
|
|
|
#include "Packet.h"
|
|
#include "Socket/SocketIO.h"
|
|
|
|
const unsigned int DemonLoginTCPPort = 10101; // Client Login TCP Port
|
|
const unsigned int DemonGameTCPPort = 10104; // Client Game TCP Port
|
|
const unsigned int DemonAuthTCPPort = 10110; // Client Auth TCP Port
|
|
const unsigned int DemonClientUDPPort = 20002; // Client UDP Port
|
|
|
|
const unsigned short NoError = 0x0000; // 에러 없음
|
|
const unsigned short WrongParameter = 0x4001; // 잘못된 인자
|
|
const unsigned short ExceptionError = 0x4002; // 예외 값 발생
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// 클래스 정의
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
class NetBase : public SocketIO
|
|
{
|
|
public:
|
|
WSABUF m_pSendDataBuffer;
|
|
char m_pSendBuffer[BufferSize];
|
|
|
|
WSABUF m_pRecvDataBuffer;
|
|
char m_pRecvBuffer[BufferSize];
|
|
|
|
WSABUF m_pRecvUDPDataBuffer;
|
|
char m_pRecvUDPBuffer[BufferSize];
|
|
|
|
SOCKET m_TCPSocket;
|
|
SOCKET m_UDPSocket;
|
|
|
|
public:
|
|
|
|
NetBase(void);
|
|
~NetBase(void);
|
|
|
|
inline int GetUseSendBuffer(void) { return m_pSendDataBuffer.len; }
|
|
inline int GetUseRecvBuffer(void) { return static_cast<int>((m_pRecvDataBuffer.buf - m_pRecvBuffer) + m_pRecvDataBuffer.len); }
|
|
inline int GetUseRecvUDPBuffer(void) { return static_cast<int>((m_pRecvUDPDataBuffer.buf - m_pRecvUDPBuffer) + m_pRecvUDPDataBuffer.len); }
|
|
|
|
int Recv(void);
|
|
int UDPRecv(LPSOCKADDR_IN Address_Out);
|
|
|
|
int PutRecvBufferToPtBuffer(char *pBuffer_Out, int BufferSize_In);
|
|
int PutUDPRecvBufferToPtBuffer(char *pBuffer_Out, int BufferSize_In);
|
|
|
|
char* GetSendBuffer(void) { return m_pSendDataBuffer.buf; }
|
|
|
|
void PutSendBuffer(bool Crypt_In);
|
|
bool FlushSendBuffer(void);
|
|
|
|
public:
|
|
inline DWORD GetDiskSerial(char Drv_In)
|
|
{
|
|
unsigned long VolumeSerial = 0;
|
|
|
|
char Root[10] = "";
|
|
sprintf(Root, "%c:\\", Drv_In);
|
|
if(!GetVolumeInformation(Root, 0, 0, &VolumeSerial, 0, 0, 0, 0))
|
|
return 0;
|
|
|
|
return VolumeSerial;
|
|
}
|
|
};
|
|
|
|
#endif |