Files
mtgodot-poc/extension/src/port/EterLib/NetDevice.cpp
T
shenleiandClaude Opus 5.5 cd3b8b506f 2V1-a: port the EterLib network layer and the Crypto++ packet cipher
NetStream/NetAddress/NetDevice/NetPacketHeaderMap and EterBase/cipher.cpp
are mechanical copies. The winsock shim maps Winsock onto BSD sockets and
keeps the Winsock semantics CNetworkStream relies on: select ignores nfds,
a socket whose connect failed is not writable (40250 times out instead),
EINPROGRESS reads as WSAEWOULDBLOCK, and SIGPIPE is ignored.

port.net covers loopback connect, send/recv, peer close, the refused
connect timeout and the client/server key agreement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 14:27:57 +09:00

41 lines
467 B
C++

#include "StdAfx.h"
#include "NetDevice.h"
CNetworkDevice::CNetworkDevice()
{
Initialize();
}
CNetworkDevice::~CNetworkDevice()
{
Destroy();
}
void CNetworkDevice::Initialize()
{
m_isWSA=false;
}
void CNetworkDevice::Destroy()
{
if (m_isWSA)
{
WSACleanup();
m_isWSA=false;
}
}
bool CNetworkDevice::Create()
{
Destroy();
Initialize();
WSADATA wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData)!=0)
return false;
m_isWSA=true;
return true;
}