使用 443 或 80 端口的 Chromium 线程

使用 443 或 80 端口的 Chromium 线程

我尝试使用命令来了解我的系统(ubuntu )ss的状态,sockets14.10

$ ss
tcp    ESTAB      0      0         192.168.1.10:51492    74.125.236.200:https   
tcp    ESTAB      0      0         192.168.1.10:45436      184.24.9.251:http    
tcp    ESTAB      0      0         192.168.1.10:33349     74.125.236.68:https   
tcp    ESTAB      0      0         192.168.1.10:45285     74.125.236.34:https   
tcp    ESTAB      0      0         192.168.1.10:52029    74.125.169.216:https   
tcp    ESTAB      0      0         192.168.1.10:49125      184.24.9.251:https   
tcp    ESTAB      0      0         192.168.1.10:49340      74.125.68.94:https   
tcp    ESTAB      0      0         192.168.1.10:47748     74.125.236.65:https   
tcp    ESTAB      0      0         192.168.1.10:32845     199.59.150.46:https   
tcp    ESTAB      0      0         192.168.1.10:34511     103.20.92.129:https   
tcp    ESTAB      0      0         192.168.1.10:43233    74.125.200.188:5228    
tcp    ESTAB      0      0         192.168.1.10:52208    74.125.169.216:https   
tcp    ESTAB      0      0         192.168.1.10:41742    184.87.213.124:http    
tcp    ESTAB      0      0         192.168.1.10:43939     74.125.68.147:https   
tcp    ESTAB      0      0         192.168.1.10:36935     74.125.236.90:http    
tcp    ESTAB      0      0         192.168.1.10:48165     74.125.236.33:https   
tcp    ESTAB      0      0         192.168.1.10:41456     74.125.236.34:http    
tcp    ESTAB      0      0         192.168.1.10:40549     74.125.236.90:https   
tcp    ESTAB      0      0         192.168.1.10:37934     122.175.190.8:http    
tcp    ESTAB      0      0         192.168.1.10:44557      31.13.79.112:https   
tcp    ESTAB      0      0         192.168.1.10:49879     74.125.236.43:https   
tcp    ESTAB      0      0         192.168.1.10:54648     23.34.240.214:http    
tcp    ESTAB      0      0         192.168.1.10:60101     74.125.236.67:https   
tcp    ESTAB      0      0         192.168.1.10:60836   108.160.165.173:http    

这里是我得到的一个输出

tcp    ESTAB      0      0         192.168.1.10:43233    74.125.200.188:5228 

然后我尝试了一下nslookup,我得到了

anupam@JAZZ:~$ nslookup 74.125.200.188
Server:     127.0.1.1
Address:    127.0.1.1#53

Non-authoritative answer:
188.200.125.74.in-addr.arpa name = sa-in-f188.1e100.net.

Authoritative answers can be found from:

我这里没有得到188.200.125.74.in-addr.arpa name = sa-in-f188.1e100.net.part ,,

然后我尝试netstat了解与此相关的 PID。

$ netstat -natp
tcp        0      0 192.168.1.10:60081      74.125.236.73:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:54746      74.125.236.199:80       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:32845      199.59.150.46:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:55852      74.125.236.67:80        ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:43119      198.252.206.25:443      ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:43233      74.125.200.188:5228     ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:41044      74.125.130.104:443      ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:56479      74.125.236.196:443      ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:48165      74.125.236.33:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:35692      74.125.236.74:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:60101      74.125.236.67:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:60836      108.160.165.173:80      ESTABLISHED 2919/dropbox    
tcp        0      0 192.168.1.10:52425      74.125.236.201:443      ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:60058      74.125.236.73:443       ESTABLISHED 5141/chromium-brows
tcp        0      0 192.168.1.10:40360      74.125.130.94:443       ESTABLISHED 5141/chromium-brows

在这里我发现它是浏览器PID 5141中的线程chromium

我的问题是,由于浏览器只是用于交换 html 页面的用户界面http或协议实现,它的任何线程如何可以使用除或https之外的其他端口(这里)?8044343233

答案1

有 2 个端口:源端口(浏览器)和一个目的端口(服务器)。浏览器向操作系统请求可用的源端口(假设它接收到33123)然后与目标端口建立套接字连接(通常80/HTTP443/HTTPS)。

当 Web 服务器收到答复时,它会发送一个以 80 为源端口、以 33123 为目标端口的响应。

因此,如果您有 2 个浏览器同时访问 stackoverflow.com,则会出现如下情况:

Firefox (localhost:33123) <-----------> stackoverflow.com (69.59.196.211:80)
Chrome  (localhost:33124) <-----------> stackoverflow.com (69.59.196.211:80)

来源 - Stack Overflow,Flavius Stef

答案2

我刚刚检查了 chromium-browser 版本的源代码65.0.3325.181-0ubuntu1.debian

# google_apis/gcm/engine/gservices_settings.cc
const char kDefaultCheckinURL[] = "https://android.clients.google.com/checkin";
const char kDefaultMCSHostname[] = "mtalk.google.com";
const int kDefaultMCSMainSecurePort = 5228;
const int kDefaultMCSFallbackSecurePort = 443;
// ...
GURL GServicesSettings::GetMCSMainEndpoint() const {
  // ...
  return GURL(MakeMCSEndpoint(kDefaultMCSHostname, kDefaultMCSMainSecurePort));
}

看起来 Chromium 正在通过端口 5228 连接到某些 Google 服务。

相关内容