• 大小: 29.93M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-02-22
  • 语言: C/C++
  • 标签: demo  p2p  

资源简介

这个是演示采用UDP协议进行P2P打洞对话原理的演示程序,参考的资料是:
1)P2P 之 UDP穿透NAT的原理与实现(附源代码)--http://www.cnpaf.net/Class/hack/0512182034513804825.htm
2)王艳平<<Windows网络与通信程序设计>>


资源截图

代码片段和文件信息

/********************************************************************
created: 2006/08/12
filename:  PeerList.cpp
author: 李创
                http://www.cppblog.com/converse/

purpose:
*********************************************************************/

#include “PeerList.h“

Peer_Info::Peer_Info()
: dwActiveTime(0)
 nAddrNum(0)
{
P2PAddr.dwIP = 0;
P2PAddr.usPort = 0;
memset(IPAddr 0 MAX_ADDNUM);
memset(szUserName 0 MAX_USERNAME);
}

Peer_Info Peer_Info::operator=(const Peer_Info& rPeerinfo)
{
if (&rPeerinfo == this)
return *this;

P2PAddr = rPeerinfo.P2PAddr;
dwActiveTime = rPeerinfo.dwActiveTime;
nAddrNum = rPeerinfo.nAddrNum;
strcpy(szUserName rPeerinfo.szUserName);
for (int i = 0; i < nAddrNum; ++i)
{
IPAddr[i] = rPeerinfo.IPAddr[i];
}

return *this;
}

PeerList::PeerList()
{

}

PeerList::~PeerList()
{
DeleteAllPeer();
}

bool PeerList::AddPeer(const Peer_Info& rPeerInfo)
{
m_PeerInfoList.push_bac

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-02-18 01:10  .vs\
     目录           0  2020-02-18 01:10  .vs\P2PDemo\
     目录           0  2020-02-18 01:22  .vs\P2PDemo\v16\
     文件       24576  2020-02-18 01:22  .vs\P2PDemo\v16\.suo
     文件    37371904  2020-02-18 01:22  .vs\P2PDemo\v16\Browse.VC.db
     目录           0  2020-02-18 01:19  .vs\P2PDemo\v16\ipch\
     目录           0  2020-02-18 01:19  .vs\P2PDemo\v16\ipch\AutoPCH\
     目录           0  2020-02-18 01:19  .vs\P2PDemo\v16\ipch\AutoPCH\bbe0dc495d8bfd2c\
     文件    69926912  2020-02-18 01:19  .vs\P2PDemo\v16\ipch\AutoPCH\bbe0dc495d8bfd2c\MAIN.ipch
     目录           0  2020-02-18 01:10  Backup\
     目录           0  2020-02-18 01:22  Backup\P2PClient\
     目录           0  2020-02-18 01:22  Backup\P2PServer\
     文件        3838  2006-08-15 22:20  CommonDefine.h
     目录           0  2020-02-18 01:12  P2PClient\
     目录           0  2020-02-18 01:12  P2PClient\Debug\
     文件       41322  2020-02-18 01:12  P2PClient\Debug\Main.obj
     文件           0  2020-02-18 01:12  P2PClient\Debug\P2PClient.Build.CppClean.log
     文件      938496  2020-02-18 01:12  P2PClient\Debug\P2PClient.exe
     文件     2384516  2020-02-18 01:12  P2PClient\Debug\P2PClient.ilk
     文件        4670  2020-02-18 01:12  P2PClient\Debug\P2PClient.log
     文件       71550  2020-02-18 01:12  P2PClient\Debug\P2PClient.obj
     文件     6262784  2020-02-18 01:12  P2PClient\Debug\P2PClient.pdb
     目录           0  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\
     文件        2422  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\CL.command.1.tlog
     文件       77660  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\CL.read.1.tlog
     文件        2198  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\CL.write.1.tlog
     文件         229  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\P2PClient.lastbuildstate
     文件        1488  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\link.command.1.tlog
     文件        3404  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\link.read.1.tlog
     文件        1008  2020-02-18 01:12  P2PClient\Debug\P2PClient.tlog\link.write.1.tlog
     文件           0  2020-02-18 01:12  P2PClient\Debug\P2PClient.vcxproj.FileListAbsolute.txt
............此处省略49个文件信息

评论

共有 条评论