端口号和协议号有什么区别?

发布于 2024-07-14 08:08:12 字数 20 浏览 5 评论 0原文

端口号和协议号有什么区别?

What is the difference between a port number and a protocol number?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

妞丶爷亲个 2024-07-21 08:08:12

您可以将端口视为电话分机,计算机的 IP 地址就像其电话号码。 您可以拨打号码(IP 地址)与计算机通话,然后拨打分机号(端口)与特定应用程序通话。 应用程序需要侦听端口才能进行通信。

协议只是对话两端的两个应用程序同意使用的语言。如果您的应用程序向我的应用程序发送字节流,我的应用程序需要知道如何解释这些字节。

You can think of a port as a phone extension, with the computer's IP address being like its phone number. You can call the number (IP address) to talk to the computer, then dial the extension (port) to talk to a specific application. An application needs to be listening on a port in order to communicate.

A protocol is just the language that the two applications on either end of a conversation agree to speak in. If your application is sending streams of bytes to my application, my application needs to know how to interpret those bytes.

琴流音 2024-07-21 08:08:12

协议=如何通信,端口=在哪里通信

Protocol = how to communicate, Port = where to communicate

旧情别恋 2024-07-21 08:08:12

协议是关于如何解释数据以及如何响应消息的协议。 它们通常指定消息格式和合法消息。 协议示例包括:

A port 是 TCP 和 UDP 中套接字端点的一部分。 它们允许操作系统区分主机上的哪个 TCP 或 UDP 服务应接收传入消息。

通常会出现混乱,因为许多端口被保留(例如端口 80),并且通常由期望特定协议的服务器监听(在端口 80 的情况下为 HTTP)。 虽然发送到端口 80 的消息通常被认为是 HTTP 消息,但没有什么可以阻止非 HTTP 服务器侦听端口 80 或 HTTP 服务器侦听替代端口(例如 8080 或 8088)。

A protocol is an agreement on how to interpret data and how to respond to messages. They generally specify message formats and legal messages. Examples of protocols include:

A port is part of socket end point in TCP and UDP. They allow the operating system to distinguish which TCP or UDP service on the host should receive incoming messages.

The confusion generally arises because, a number of ports are reserved (eg. port 80) and are generally listened to by severs expecting a particular protocol (HTTP in the case of port 80). While messages send to port 80 are generally expected to be HTTP messages, there is nothing stopping an non-HTTP server from listening on port 80 or an HTTP server from listening on an alternative port (for example 8080 or 8088).

有深☉意 2024-07-21 08:08:12

港口=船舶进港的地方
协议 = 货物如何装载到船上

Port = Place where ships come in
Protocol = How the cargo is loaded on the ship

说好的呢 2024-07-21 08:08:12

每个人都是对的:我最喜欢的比喻是其中一艘船。 港口:货物在哪里装载,协议:货物如何装卸。

这篇维基百科文章可能对您有一点帮助。

http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Everyone is right: my favorite analogy is the one of the ships. Port: where cargo is loaded, Protocol: how the cargo is loaded/unloaded.

This wikipedia article might help you a little.

http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

我的痛♀有谁懂 2024-07-21 08:08:12

在IP术语中,协议号是分配给IP内承载的第4层协议的值,例如TCP为6,UDP为17,通常在/etc/protocols 文件。

端口号在 UDP 和 TCP 标头中用于表示这些协议中承载的不同更高级别协议,例如 SMTP 为 25,HTTP 为 80 等,每个 /etc/services.

In IP terms, a protocol number is the value assigned to the Layer 4 protocol carried within IP, e.g. 6 for TCP, 17 for UDP, as often found in the /etc/protocols file on most UNIX systems.

A port number is used within the UDP and TCP headers to represent different higher level protocols carried within those protocols, e.g. 25 for SMTP, 80 for HTTP, etc, per /etc/services.

情徒 2024-07-21 08:08:12

协议是两个设备如何以双方都能理解的方式交换数据的规范。 端口是一种编号的“标签”,可以帮助计算机决定谁应该接收传入的数据。

许多协议都有一个默认运行的端口; 这使得更容易发现它们或配置使用它们的应用程序。 但这并不是一条硬性规定; 只要联系他们的人知道这一变化,他们就可以随时在不同的端口上监听。

A protocol is a specification for how two devices should exchange data in a way that they can both understand. A port is kind of a numbered 'tag' that helps a computer decide who should receive an incoming piece of data.

Many protocols have a port that they run on by default; this makes it easier to discover them or configure applications that use them. But that's not a hard rule; they could always listen on a different port, as long as anyone contacting them knew about the change.

爱冒险 2024-07-21 08:08:12

端口 = 耳朵、嘴巴、眼球、触觉
协议 = 英语、西班牙语、手语、盲文

ports = ears, mouth, eyeball, touch
protocols = English, Spanish, Sign Language, Braille

琴流音 2024-07-21 08:08:12

简单端口意味着您与谁通信。
& 协议是指如何通信或通信方式。

in Simple port means to whom you communicate.
& Protocol means how to communicate or way of communication.

初雪 2024-07-21 08:08:12

端口只是您选择用于通信的通道,协议决定了通信的方式。 某种协议通常使用特定的端口,例如 HTTP 使用端口 80,FTP 使用端口 21。

A port is just a channel that you select for the communication, and the protocol determines how the communication is done. A certain protocol usually uses a specific port, like port 80 for HTTP, port 21 for FTP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文