- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
WebSockets have the option发送 ping 到另一端,另一端应该用 pong 响应。
Upon receipt of a Ping frame, an endpoint MUST send a Pong frame inresponse, unless it already received a Close frame. It SHOULDrespond with Pong frame as soon as is practical.
TCP offers something similar以keepalive的形式:
[Y]ou send your peer a keepalive probe packet with no data in it and the ACK flag turned on. You can do this because of the TCP/IP specifications, as a sort of duplicate ACK, and the remote endpoint will have no arguments, as TCP is a stream-oriented protocol. On the other hand, you will receive a reply from the remote host (which doesn't need to support keepalive at all, just TCP/IP), with no data and the ACK set.
我认为 TCP keepalive 更有效,因为它可以在内核中处理,而不需要将数据传输到用户空间,解析 websocket 帧,制作响应帧,然后将其交还给内核传播。它还减少了网络流量。
此外,WebSockets are explicitly specified始终运行在 TCP 上;它们与传输层无关,因此 TCP keepalive 始终可用:
The WebSocket Protocol is an independent TCP-based protocol.
那么为什么人们会想要使用 WebSocket ping/pong 而不是 TCP keepalive?
最佳答案
TCP keepalive存在的问题是:
与 WebSockets ping/pong 的比较没有意义。 TCP keepalive 是自动的,并且在启用时是定时的,而 WebSocket ping/pong 是根据应用程序的要求执行的。
关于tcp - WebSockets ping/pong,为什么不是 TCP keepalive?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23238319/
几个月来我们遇到了一个奇怪的小问题: 我们集群上的负载(http、具有大量非常短(<100ms)请求的持久保持事件连接)分布非常不均匀。所有服务器都以相同的方式配置,但某些每秒推送数千个请求的连接最终
几个月来我们遇到了一个奇怪的小问题: 我们集群上的负载(http,具有大量非常短(<100 毫秒)请求的长期保持事件连接)分布非常不均匀。所有服务器都以相同的方式配置,但一些每秒推送数千个请求的连接最
List resultList = lists.iterator().next(); for (Iterator iterator = lists.iterator(); iterator.h
根据 PostgresSQL docs有参数 keepalives 和进一步的参数 keepalives_idle, keepalives_interval 和 keepalives_count 只有
我最近接手了一个 Android 项目。我们希望尝试加快我们拥有的同步过程。这是目前的代码: System.setProperty("http.keepAlive", "false"); 我没有写代码
我应该使用什么代码片段来配置普通的 Jersey Client 实例以“保持 Activity ”连接?谢谢! 最佳答案 假设您指的是 HTTP keep-alives,默认情况下支持它,并且可以通过
在套接字上的 accept() 之后,我正在尝试配置 TCP keepalive。 SockConnected = accept(SockListen, &RemoteAddr,
在 nginx.org 中,keepalive config 的默认值是 —,但我不太明白这是什么意思。 Syntax: keepalive connections; Default: — Co
我已经升级到 0.9.0.1,看起来很顺利,我的 meteor 网站运行良好。 但是,在对模板进行简单更改时(字面上更改跨度内的文本),我在服务器控制台中收到错误,然后服务器重新启动。 服务器控制台日
在 SignalR (1.2.2) 中,KeepAlive 和 ConnectionTimeout 之间有什么区别? 通过保持事件状态主动 ping 服务器,连接永远不会超时。那么Connection
我的 grunt 任务如下所示: grunt.registerTask "default", [ "clean:dist" # "useminPrepare" "copy:di
我管理着几个 DNN 门户,我需要一个解决方案来让它们在流量空闲时保持“活跃”。在给定的不活动时间后,IIS 将从内存中卸载 DNN 应用程序,这将影响第一个客户端请求的加载时间。 DNN 有一个“K
我正在尝试使用服务器发送事件传输查看从 Signalr 服务器发送的保持事件事件。我正在使用 Fiddler 来查看它,并且启用了“Stream”Fiddler 功能按钮......到目前为止我没有看
使用apache,当KeepAlive为Off时减少MaxClients是否合理?目前,MaxClients 设置为 150,这是 mpm-worker 的默认值。 nginx 为 apache 提供
我有一个 mediaOutput 标签,它的 createContent 属性要求支持 bean 处于某种状态。必须提供填充在 init 方法中的值列表。 因此,我为整个支持 bean 添加了一个 k
我设置了客户端和服务器之间有防火墙的设置。我连接到两个不同的服务器,即 A 和 B,数据可以在任何时间点从 A 或 B 流动,但一次只能流动一个。似乎我与服务器的连接每 2 小时 11 分 15 秒后
在 Android WebView 中创建 XMLHttpRequests 时,没有像看起来那样使用保活连接。 当请求频繁发出时,我的桌面浏览器都使用 keepalive(例如,在页面的 onload
场景如下: 有一个 http 反向代理,它有一个与应用程序服务器的持久连接池。它已经收到来自客户端的请求,并在检查连接是否打开后向后端发出相同的请求 与此同时,服务器在收到请求之前关闭了连接,代理因从
在他的article about preventing multiple instances Michael Covington 展示了一个应用程序的代码: static void Main()
当我执行 netstat -anto 时,我得到了以下输出 Proto Recv-Q Send-Q Local Address Foreign Address
我是一名优秀的程序员,十分优秀!