What exactly is the address (identifier) of the application layer?

13. "Computer Network Tutorial: Top-Down Approach" (2012) Author: Behrouz A. Forouzan – WhiteNight's Site

Tag: "Computer Network Tutorial: Top-Down Approach" (2012) Author: Behrouz A.Forouzan, Reading notes

P29 socket address

为什么要把套接字地址单独拿出来写篇笔记?因为我个人觉得某个问题会比较有意思,这个问题会在稍后提到。

We need to define the socket address with the identifier of the TCP/IP protocol suite.

为啥非得是它们的标识符?仔细想想,物理层没地址,数据链路层的标识符是MAC地址;网络层的是IP地址;传输层的是端口。而且现在我们常用的也是用IP地址+端口的形式去访问后端也好,传数据也好,总之就是用于数据的交换。
这里有个很有意思的问题:应用层的地址是什么?如果应用层之间建立连接,那么这两个应用层通过什么地址来传输数据呢?
网页地址(www.baidu.com),邮箱地址([email protected])这些都是具体地址(Specific Address)。应用层则是通过这些具体地址来传输数据的。
至于为啥不用具体地址作为标识符,因为像网页地址其实就是协议+主机名+主机路径,主机名最后还是映射到一个IP地址上,邮箱地址也是通过DNS去查找对应的IP地址。那不如一开始就用IP地址+端口。

This means that the socket address should be a combination of an IP address and a port number.

Since a socket defines a communication endpoint, we can say that a socket is identified by a pair of socket addresses, a local socket address and a remote socket address.

说白了,套接字(接口)需要用套接字地址来表明谁是接收方,谁是发送方。再通过这个接口将应用层的数据将传给传输层,最后再一路走到目的主机的传输层。目的主机的应用层再将这个信息通过套接字(接口)读取出来。

Guess you like

Origin blog.csdn.net/white_night_SZTU/article/details/134473168