Network overview
1. Computer network overview
(1) Routers and switches constitute the core computer network, the computer is only the node on this network and control, etc., through the optical fiber, network cable and other connections to connect the device, thus forming a huge computer network.
(2) The main advantage of the network is sharing: Sharing devices and data, now the most common device sharing devices is the printer.
(3) IP address: In order to be able to easily identify each device on the network, a unique digital ID for each device in the network. The name IP address is now defined as the IPV4 protocol, which specifies that each IP address consists of a number of 4 0-255, such as 10.0.120.34. The IP address may be fixed, such as a variety of servers on the network, or it can be dynamic, such as broadband users using ADSL dial-up internet access.
(4) Domain name: for example, Sohu.com. An IP address can correspond to multiple domain names, and a domain name can only correspond to one IP address.
(5) DNS server: The data transmitted in the network, all the IP address as the address identification, so in the actual transfer of data before the need to convert the domain name to an IP address, the realization of such a function of the server called a DNS server, that is, popular parlance is called Domain name resolution.
(6) Port: Allows a computer to run multiple network programs at the same time, and each program corresponds to a unique port on the same computer. On the hardware, the port number must be located between 0-65535, each port is unique to a network program, a network program can use multiple ports.
2. Network Programming Overview
(1) Network programming is the exchange of data between two or more programs.
(2) "Request-response" model: one end of the communication sends the data, the other side feeds back the data, and the network communication is based on the model. In network communication, the first program to initiate the communication is called the client program, which is called the client, and the program waiting for the connection in the first communication is referred to as the server side (server) program, or server. Once the communication is established, the client and server side are exactly the same, without the essential difference.
(3) client/server structure: Also known as client/server structure, referred to as C/s structure. Advantages: The client is specially developed, according to the need to achieve a variety of effects; disadvantage: Poor versatility, almost no general purpose, in the actual maintenance, also need to maintain a dedicated client and server side, maintenance of a large pressure.
(4) Browser/server structure: Also known as browser/server structure, referred to as B/s structure. Advantages: The development of the pressure is small, do not need to maintain the client; disadvantage: The browser limit is relatively large, the performance is not strong, can not perform system-level operation. b/s structure is actually a special C/s structure.
(5) To Peer program: is a special program, including both client programs, but also contains server-side programs. Use the client program section to connect to other seeds (server side) while using the server side to transfer data to other BT clients.
(6) Protocol (PROTOCOL): The format of the data when the data is actually exchanged. Because of the different protocol formats between the various network programs, the client program is a dedicated structure.
3. Network communication mode
(1) In the existing network, there are two main ways of network communication:
·TCP(传输控制协议)方式·UDP(用户数据报协议)方式
(2) TCP mode: In this way for network communication, the need to establish a dedicated virtual connection, and then reliable data transmission, if the failure to send a message, the client will automatically resend the data. Important data is typically transmitted using TCP. Because TCP needs to establish a dedicated virtual connection and verify that the transmission is correct, TCP is a bit slower to use, and the amount of data that is transmitted is slightly larger than UDP.
(3) UDP mode: In this way for network communication, do not need to establish a dedicated virtual connection, transmission is not very reliable, if the sending fails the client is not available. A large number of non-core data are transmitted via UDP.