Chapter 2 - Getting Started in the Internet (2)

xiaoxiao2021-03-06  44

Chapter 2 - Getting Started in the Internet (2)

Now everyone knows the most basic network layers and interfaces. This chapter will continue to learn some hostnames, connects, and some software layer protocols.

DNS

DNS (Domain Name System Domain Name Resolution System), which can transform hostnames with IP addresses. Obviously, IP address is not so good, so there is a actual naming system, now we use the host name to represent IP, such as: www.sina.com.cn, www.google.com, very familiar? Most of us will not use 210.51.179.90 (www.sina.com.cn to see the news due to different readers may not be this IP address)? After I knocked into the URL in the browser, the computer first found a network service provider DNS host to get the corresponding IP address. And send this IP to you, your browser will use this IP to access the website you expect. If there is no IP corresponding to this URL, then the DNS server will ask for the DNS server to the previous level, so that It can always be found. If you find it, you will come back, the lower DNS server is updated (you will not bother to lead ...).

2. Connect Connections

TCP / IP is a join wizard protocol that is always connected to two devices, each has its own IP address and port, one is called a server, and another is called a client.

The client issues a request, and the server has a response. For example, let's open an URL, then our browser is the client, the website server is the server. The browser finds the resources you hope to the server, the server naturally sends back the requested information. (This is the legendary B / S structure, this is the soil of software engineering, saying far ...)

The server must have been waiting for a new request connection, which is called listening, which acts on a specific IP and port number. The client only needs to move, the client initiates a connection and requests a request. To establish a connection, the client needs to know the IP and port number listening to the server. Any TCP / IP session connection is both methods, a variety of protocols, and the server is turned to the client.

Although the client and the server use IP and port numbers, only the port of the server is fixed. The client's IP is this machine IP and the port is a random port number (this port is definitely no program in listening, generally greater than 1024), an example, the standard WWW port is 80 (http). Do it with Google, its server IP address is 216.239.63.104:80 (possibly with everyone is not the same) port is 80. Let's open a few connectors, Google Different content, then open the command and the prompt window to type the command "netstat -an", let's see:

TCP xxx.xxx.xxx.xxx:3427 216.239.63.104:80 Establishedtcp xxx.xxx.xxx.xxx:3428 216.239.63.104:80 ESTABLISHED

xxx.xxx.xxx.xxx is my IP address, 216.239.63.104 is the port number behind Google's IP colon. We can notice that the client's port number is random. Each connection has its own port number. This way the server knows who will send the information to anyone ... Client Client A program for initiating connection, request information. The Program That Initiates The Connection, And Requests Information. Server is used to listen, process, respond, respond to programs, their IP and port numbers are fixed and subject to the client. The Program That Listens for Incoming Connections, Accepts The Received Requests. The IP and Port Numr of the Server Need To CONNECT To IT.

3. Agreement protocols again

In the previous chapters, we introduced several protocols in different layers. We did not discuss the agreement in the application layer, like HTTP, FTP, POP3, SMTP. They are all working in the form of C / S (Client-Server). Different format requests for servers are using different protocols, now we are not discussed here. We do this in the future Winsock base programming.

转载请注明原文地址:https://www.9cbs.com/read-59230.html

New Post(0)