to Kevin_qing斑竹,NAT是什么?(中文意思)你说的得到端口,这个端口是不是应用程序端口?是不是对方通过这个端口就可以定位到局域网里的机子呢?但是我觉得处于一个局域网里的不同机子的端口难道是一定不同的吗?
如果用了NAT,这些都是透明的,就好像局域网中的机子直接连到外面一样。WinRoute有NAT功能: Network Address Translation (NAT) is a process that modifies packets sent from/to the local area network to/from the Internet or other IP based networks.On the way out Packets passing through the address translator engine on the way from the LAN are changed or translated to look as if they came from the computer running NAT (this computer is directly connected to the Internet). What actually happens is the "source" IP address is changed in the header replaced by (public) IP address of the "NAT" computer.The NAT engine also creates a record table of information for each packet that passed through to the Internet.On the way back Packets passing through the NAT on the way to the LAN are searched against to the records kept by the NAT engine. There the "destination" IP address is changed (based on the records in the database) back to the specific internal private class IP address in order to reach the computer on the LAN .Remember that the packet came with the public IP address of the NAT computer as a "destination" originally. The NAT engine had to change this information in order to deliver the packet to the correct recipient within the local network.
maxsuy你说容易,请你讲讲
另外两个局域网没有server中转的话一定是不可能直接发送的,但是可以早开始的时候通过Server转包,然后得到端口就可以直接通讯了。
Network Address Translation (NAT) is a process that modifies packets sent from/to the local area network to/from the Internet or other IP based networks.On the way out
Packets passing through the address translator engine on the way from the LAN are changed or translated to look as if they came from the computer running NAT (this computer is directly connected to the Internet). What actually happens is the "source" IP address is changed in the header replaced by (public) IP address of the "NAT" computer.The NAT engine also creates a record table of information for each packet that passed through to the Internet.On the way back
Packets passing through the NAT on the way to the LAN are searched against to the records kept by the NAT engine. There the "destination" IP address is changed (based on the records in the database) back to the specific internal private class IP address in order to reach the computer on the LAN .Remember that the packet came with the public IP address of the NAT computer as a "destination" originally. The NAT engine had to change this information in order to deliver the packet to the correct recipient within the local network.
HowUCan,我先看看你给的资料了,先谢谢了;)
c2->gatway2->server ip2:port2server ->c1(ip2:port2)
server ->c2(ip1:port1)
c1<->gatway1<->gatway2<->c2
?QQ,C/S UDP原码的请进。
但是需要照我说的哪个流程来做。也就是先由两个client像某一个server发消息,得到上面映射的端口
然后这个server通知他们对方的端口,然后就可以通信了
另外要注意的是gatway上面映射的端口是有超时时间的,所以需要定时发送些数据,以保持端口映射不会被close。