联合开发网   搜索   要求与建议
                登陆    注册
排序按匹配   按投票   按下载次数   按上传日期
按分类查找All P2P编程(1) 
按平台查找All C/C++(1) 

[P2P编程] pertoper

一个模拟P2P聊天的过程的源代码,过程很简单,P2PServer运行在一个拥有公网IP的计算机上,P2PClient运行在两个不同的NAT后(注意,如果两个客户端运行在一个NAT后,本程序很可能不能运行正常,这取决于你的NAT是否支持loopback translation,详见http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt,当然,此问题可以通过双方先尝试连接对方的内网IP来解决,但是这个代码只是为了验证原理,并没有处理这些问题),后登录的计算机可以获得先登录计算机的用户名,后登录的计算机通过send username message的格式来发送消息。如果发送成功,说明你已取得了直接与对方连接的成功。 程序现在支持三个命令:send , getu , exit send格式:send username message 功能:发送信息给username getu格式:getu 功能:获得当前服务器用户列表 exit格式:exit 功能:注销与服务器的连接(服务器不会自动监测客户是否吊线)
a peer-to-peer chatting simulation of the process of source code, the process is very simple. P2PServer operation in a public IP with the computer, P2PClient running in two different NAT after (Note If two clients running on a NAT, the procedure may not be operating normally, It depends on whether you support the loopback NAT translation, see http :// midcom-p2p.sourceforge.net/draft-ford- midcom- p2p- 01.txt, of course, this problem can be made by the two sides try to connect with each other to resolve the IP network, but the code is to verify principle, not dealing with these issues), after the computer can log logged in a computer user name, after logged by the computer username send the message format to send information. If the success of this show that you have made a direct link (2006-04-25, C/C++, 30KB, 下载77次)

http://www.pudn.com/Download/item/id/175798.html
总计:1