Introduction - If you have any usage issues, please Google them yourself
A simulated P2P chat source code, the process of the process is very simple, P2PServer run on a computer with public IP, P2PClient after operation in two different NAT (note that if the two client runs after a NAT, the program may not run normally, it depends on whether your NAT support loopback translation, see http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt, of course, this problem can be through the first tries to connect the other side of the IP network to solve, but the code is to verify that principle, does not deal with these problems), log on first login after the computer can get the computer user name and login after the computer through the send username message format to send messages. If you are successful, you have succeeded in connecting directly with the other person.
Packet : 121114114p2p_by_shootingstars.rar filelist
P2P_by_shootingstars\P2P\Exception.h
P2P_by_shootingstars\P2P\P2PClient\P2PClient.dsp
P2P_by_shootingstars\P2P\P2PClient\P2PClient.dsw
P2P_by_shootingstars\P2P\P2PClient\P2PClient.opt
P2P_by_shootingstars\P2P\P2PClient\P2PClient.plg
P2P_by_shootingstars\P2P\P2PClient\P2PClient.sln
P2P_by_shootingstars\P2P\P2PClient\P2PClient.suo
P2P_by_shootingstars\P2P\P2PClient\P2PClient.vcproj
P2P_by_shootingstars\P2P\P2PClient\P2PClient.ncb
P2P_by_shootingstars\P2P\P2PClient\P2PClient.cpp
P2P_by_shootingstars\P2P\P2PServer\P2PServer.cpp
P2P_by_shootingstars\P2P\P2PServer\P2PServer.dsw
P2P_by_shootingstars\P2P\P2PServer\P2PServer.opt
P2P_by_shootingstars\P2P\P2PServer\P2PServer.plg
P2P_by_shootingstars\P2P\P2PServer\P2PServer.sln
P2P_by_shootingstars\P2P\P2PServer\P2PServer.suo
P2P_by_shootingstars\P2P\P2PServer\P2PServer.vcproj
P2P_by_shootingstars\P2P\P2PServer\P2PServer.ncb
P2P_by_shootingstars\P2P\P2PServer\P2PServer.dsp
P2P_by_shootingstars\P2P\readme.txt
P2P_by_shootingstars\P2P\UDP穿越NAT.TXT
P2P_by_shootingstars\P2P\proto.h
P2P_by_shootingstars\P2P\proto.h.bak
P2P_by_shootingstars\P2P\P2PClient
P2P_by_shootingstars\P2P\P2PServer
P2P_by_shootingstars\P2P
P2P_by_shootingstars