In that year, we learned Linux C-network programming's communication mechanism and architecture model step by step.

Source: Internet
Author: User

This series of articles written by muge0913, reproduced please note the Source: http://blog.csdn.net/muge0913/article/details/7339915

When talking about Linux, we can't help but mention network technology. Linux is a product of a Network. It can be freely downloaded, modified, and improved on the network .. Linux supports multiple network protocols, and its shell also provides powerful online commands. These advantages allow Linux to provide complete solutions for many small and medium network applications.

 

When it comes to computer networks, we have to first introduce their communication mechanisms and architecture models.

1. Communication Mode

All network communication methods can be divided into two types: Line switching and packet switching.

The so-called line switching means that a specific line connection is established between the sending end and the receiving end during transmission, and data can be transmitted on this line. The most common telephone is the use of this line exchange technology. However, the computer network adopts the packet exchange method. All computers use a common network connection. The data to be transmitted by the Data sender is divided into blocks, and each block is properly processed (Data encapsulation) to form a data packet, the package contains necessary information such as the acceptor address, and each package is transmitted separately. The data in the package is not limited. As long as the data is transmitted correctly, the specific information should be defined, which is related to the Protocol used.

2. OSI standards

The OSI Standard is the Open System Interconnection standard. It is a reference model proposed by the International Organization for Standardization in 1977. It defines a layer-7 communication protocol standard. The specific layered structure and functions are as follows (from high to low ):

(1) Application Layer

The application layer is the highest layer of the network, that is, the layer closest to the user. The application layer contains network application software built on various communication protocols, which can directly interact with users. For example, email and file transfer programs.

(2) Presentation Layer

The presentation layer represents and interprets the transmitted data, including data conversion, data encryption, and data compression. Its main functions are: to provide users with means to execute session-layer service primitives, to describe complex data structures, and to manage the data structure set currently required; converts the internal and external formats of data.

(3) Session Layer

The Session Layer uses the reliable end-to-end communication service provided by the transport layer protocol, and adds additional features required by users and establishes data exchange between users on different machines.

(4) Transport Layer

It is the core layer in the OSI network architecture. It separates the actually used Communication Subnet from the high-level application to provide highly reliable and low-cost data transmission between the sending end and the receiving end. Both TCP and UDP protocols belong to this layer.

(5) Network Layer

The Network Layer defines the interaction between the host and the network. It is also called the Communication Subnet layer. It defines the basic data units transmitted in the network and the concept of destination addressing and routing. The IP protocol belongs to this layer.

(6) data link layer

The data link layer packages and encapsulates the data from the lower layer, splits the data from the upper layer into frames, and completes traffic control and error handling.

(7) Physical Layer

The physical layer is the bottom layer of OSI, which specifies the transmission media itself and its associated mechanical and electrical interfaces. These interfaces and transmission media must ensure consistency between sending and receiving signals.

 

TCP/IP protocol

TCP/IP is a set of protocols that provide reliable data transmission and connectionless data services in the network. The protocol that provides reliable data transmission is called the transmission control protocol TCP, while the Protocol that provides the connectionless data packet service is called the Internet Protocol IP. However, the TCP/IP protocol is not only a set of TCP and IP protocols, but also a set of network protocols that contain many other protocols.

The TCP/IP protocol started running on the ARPA network in 1983, and was inserted into the bsdunix operating system kernel that year, becoming part of the operating system. Subsequently, the TCP/IP protocol became the most widely used protocol with the popularity of UNIX operating systems. The main services provided by the network using the TCP/IP protocol include email, file transfer, remote login, network file system, video conferencing system, mwsaic and World Wide Web.

The TCP/IP protocol architecture consists of four layers (from high to low ):

(1) Application Layer

The application layer includes network applications and Network processes. It is an interface for interacting with users. It provides users with various services, including remote logon, file transmission, and email. It serves as the application layer, presentation layer, and Session Layer in OSI.

(2) Transport Layer

It is equivalent to the transport layer in OSI. It provides communication services for applications. This communication is also called end-to-end communication. It has three main Protocols: Transmission Control Protocol (TCP), user data packet protocol (UDP), and Internet Control Message Protocol (ICMP ).

For the purpose of establishing highly reliable message transmission, TCP is responsible for sending a large amount of user data into multiple data packets according to a certain length, after receiving the data packets, the user data is reorganized and restored in the decomposition order. It is a reliable connection-oriented two-way communication data stream.

The UDP protocol provides the connectionless data packet transmission service, which splits user data into multiple data packets and sends them to the receiver. It has the advantages of low code execution and low system overhead and fast processing speed.

ICMP is mainly used for message communication between host and gateway and Internet management center to control the operation of the management network. The ICMP protocol can send error messages to the end host of the sent data packet, and it can also limit traffic.

(3) Network Layer

Equivalent to the OSI network layer, the IP protocol is used. It is used to handle communication problems between machines. It receives transport layer requests and transmits a group with destination address information. This layer encapsulates the packet into the IP packet, fills in the packet header (packet header), and uses the routing algorithm to choose whether to directly send the packet to the target host or to the router, then, the packet is sent to the corresponding network interface module in the network interface layer below.

(4) Network Interface Layer

It is equivalent to the data link layer and Physical Layer in OSI. It is responsible for receiving IP data packets and sending data packets through the selected network.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.