服务器接受TCP连接时端口是否会更改?

编程入门 行业动态 更新时间:2024-10-25 18:32:56
本文介绍了服务器接受TCP连接时端口是否会更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当客户端使用TCP连接到服务器时,将为TCP流创建一个新的套接字.连接是保留在建立连接的同一端口上还是更改为其他端口?

When a client connects to a server using TCP, a new socket is created for the TCP stream. Does the connection remain on the same port the connection was made or does it get changed to some other port?

推荐答案

新套接字是一种应用程序级的概念,因为每个已建立的连接都需要一个唯一的文件描述符(也不同于监听文件描述符),该描述符映射到,但与TCP会话不同.会话本身是通过源地址和目标地址以及端口的组合来标识的.通常,源(客户端)端口是随机选择的,而目标(服务器)端口是侦听端口.没有分配其他端口.

The new socket is an application-level concept introduced because each established connection needs a unique file descriptor (also distinct from the listening file descriptor), which maps to, but isn't the same as, a TCP session. The session itself is identified by the combination of source and destination address and port. The source (client) port is usually chosen at random, while the destination (server) port is the listen port. No additional port is allocated.

更多推荐

服务器接受TCP连接时端口是否会更改?

本文发布于:2023-10-15 00:51:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是否会   端口   服务器   TCP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!