简体   繁体   English

邮件应用程序如何“绕过”防火墙?

[英]How do Messaging Applications “Bypass” Firewalls?

there. 那里。 I am currently making a python net-chat program of sorts. 我目前正在制作各种python网络聊天程序。 Currently it only works on a local network and cannot send messages to clients connected outside the network due to their router's firewall blocking the messages that are being sent to them. 当前,它仅在本地网络上工作,并且无法将消息发送到网络外部连接的客户端,这是因为其路由器的防火墙阻止了正在发送给它们的消息。

So, my question is: How do messaging applications "bypass" firewalls to send messages to clients? 因此,我的问题是:消息传递应用程序如何“绕过”防火墙以将消息发送给客户端? Do they use something like "fetching" the information from the server and it tunnels the message back to them? 他们是否使用了类似的方法,例如从服务器“获取”信息,然后将消息通过隧道传送回他们? But even that would use large amounts of battery if it was fetching every second. 但是,即使它每秒获取一次,也会消耗大量电池。 And fetching every minute is just impractical. 而且每分钟获取都是不切实际的。 I was thinking that they use more of a "push" protocol much like my IMAP server "pushes" my emails to my cellphone. 我当时在想,他们使用了更多的“推送”协议,就像我的IMAP服务器将电子邮件发送到手机上一样。 But how do those connections go through the firewall? 但是这些连接如何通过防火墙?

I think what you are looking for is a push notification architecture of some kind. 我认为您正在寻找的是某种推送通知体系结构。 I would point you to these two resources: 我将向您指出以下两个资源:

Essentially the client device sets up a full duplex connection with a notification server which it keeps open indefinitely. 本质上,客户端设备与通知服务器建立全双工连接,并无限期保持打开状态。 App servers register with the notification server and when they won't to notify a client device they send the message to the notification server that uses the open connection to the client device to notify them. 应用服务器在通知服务器中注册,并且当它们不通知客户端设备时,会将消息发送到通知服务器,该服务器使用与客户端设备的开放连接来通知它们。 Usually different apps use the same notification server for efficiency reasons. 通常,出于效率原因,不同的应用程序使用同一通知服务器。

So to recap, client device establishes a duplex connection with the notification server, app server sends notification for client to notification server, notification server sends the notification to the appropriate client. 概括地说,客户端设备与通知服务器建立双工连接,应用服务器将客户端的通知发送到通知服务器,通知服务器将通知发送到适当的客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM