1. 程式人生 > >Android 谷歌gcm推送所需要的埠

Android 谷歌gcm推送所需要的埠

          如果有人做過谷歌gcm的推送功能,就會想知道,如果將註冊訪問谷歌網站的服務放到伺服器上,為了安全起見,就會要求只能開通對應的谷歌服務埠,經過一番查詢,記錄如下:

I've finally figured out what the problem is. The corporate firewall is blocking traffic on the native GCM port of 5228. (5229 and 5230 are also mentioned with relation to GCM but we're not seeing any attempted traffic on those ports at all.) This much is well documented elsewhere (just Google GCM port 5228).

What I can't find clearly documented anywhere, but we've figured out from our server logs and from running Connection Tracker on the handsets, is that newer versions of Android fall back to using port 443 (the standard HTTPS port) which most firewalls allow traffic through by default. This is how our devices running newer Android versions are working even behind the firewall. I don't know precisely what Android version introduced this port 443 fallback, but it's somewhere between 4.1.2 (not working) and 4.3 (working).
Note: If your organization has a firewall that restricts the traffic to or from the Internet, 
you need to configure it to allow connectivity with GCM in order for your GCM client apps to receive messages. 
The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230. 
GCM doesn't provide specific IPs, so you should allow your firewall to accept outgoing connections to all IP addresses contained 
in the IP blocks listed in Google's ASN of 15169.

上面以上的英文意思其實就是說訪問谷歌的伺服器地址是https的,(伺服器地址為http://android.googleapis.com/):需要出站的埠是433,還有谷歌必須的服務出站埠是:5228,5229,5230

      記錄一下,希望對有些需要的朋友有用。