没有端口转发的Skype如何工作? [英] How does Skype work without port forwarding?

查看:89
本文介绍了没有端口转发的Skype如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个在端口30000上运行的 p2p 应用程序.我的路由器不是 UPnP ,因此我需要将端口转发到路由器.但是 Skype 另一个p2p应用程序可以在我的电脑上运行而无需端口转发.当我用Wireshark分析它时,我发现它使用的是UDP端口48980、58544.我使用的是c ++.

I am designing a p2p application which works on port 30000. My router is not UPnP so I required to forward a port to router. But Skype a another p2p application works without port forwarding on my pc. When I analyzed it with wireshark I found its using UDP port 48980, 58544. I am using c++.

在python中有一个库此处用于 Nat PnP路由器.是否可以通过编程方式将端口转发到路由器,而与路由器和操作系统的类型无关.用c ++或任何其他语言实现的方式应该是什么.

There is a library in python here which does it for Nat PnP routers. Is it possible to programmatically forward port to router irrespective of type of router and operating system. What should be the approach to do it in c++ or any other language.

推荐答案

Skype的工作方式非常有趣.根据我所读的内容(这是前一阵子),它的工作方式如下:

Skype works in a very interesting way. From what I've read (and this is a while ago) it works as follows:

  • Skype服务器维护所有列表 用户和IP.
  • Skype用户A想要 与用户B通话
  • Skype用户A发送一个 网络数据包到用户B的IP地址 并等待回应. (用户B从未收到此数据包).
  • Skype用户A通知服务器IP/端口 正在等待的组合 寻求回应
  • 服务器通知用户B 向用户A发送响应 指定的端口
  • 已建立连接.
  • Skype server maintains a list of all users and IPs.
  • Skype user A wants to speak to user B
  • Skype user A sends a network packet to user B's IP address and waits for a response. (user B never gets this packet).
  • Skype user A notifies server of IP/port combination on which it is waiting for a response
  • Server notifies user B to send a response to user A on the specified port
  • A connection is made.

这可能过于简化,但最后我检查了一下,这是它的工作方式. (如果我错了,请纠正我.)

This is probably over simplified but last I checked, this is how it works. (Someone correct me if I'm wrong).

编辑:已解决的项目符号问题

fixed bullet issue

这篇关于没有端口转发的Skype如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆