创建 TCP 连接的一般开销 [英] General overhead of creating a TCP connection

查看:37
本文介绍了创建 TCP 连接的一般开销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道与 UDP 相比,创建新连接的一般成本.我知道 TCP 需要初始数据包交换(3 次握手).其他费用是多少?例如,内核中是否有某种魔法需要设置缓冲区等?

I'd like to know the general cost of creating a new connection, compared to UDP. I know TCP requires an initial exchange of packets (the 3 way handshake). What would be other costs? For instance is there some sort of magic in the kernel needed for setting up buffers etc?

我问的原因是我可以保持现有连接打开并根据需要重用它.但是,如果重新连接的开销很小,则会降低复杂性.

The reason I'm asking is I can keep an existing connection open and reuse it as needed. However if there is little overhead reconnecting it would reduce complexity.

推荐答案

与数据包交换的延迟相比,所有其他成本(例如内核设置时间)都微不足道.

Compared to the latency of the packet exchange, all other costs such as kernel setup times are insignificant.

这篇关于创建 TCP 连接的一般开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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