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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
afe63bfa61
commit
cd3b8b506f
@@ -0,0 +1,41 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user