19. Network Programming

Network Architecture

Stand-alone

  • Stand-alone game

The following two web-based

CS architecture

Client client / server server

  • Server unified treatment have better security and stability and relatively easy to upgrade, but will increase the burden on the server.
  • The client will burden assigned to each user, which can save server resources, security is relatively low, the client does not networking, data is not updated.

BS Architecture

Browser browser / server server

The applications on the browser

The composition of the Internet and the Internet

internet connection between two computers is actually a series of uniform standards, which is called Internet Protocol, the nature of the Internet is a series of agreements, collectively called 'Internet Protocol'.

Edge portion: client / server, the ordinary computer, responsible for receiving / transmitting data

Transmission equipment transmission networks, routing, base station responsible for data: the core part

Internet consists of:

  • Hardware: network available to you
  • Software: applications for specific tasks

OSI seven

Have said the Internet is essentially a series of agreements, in accordance with the different functions into Internet protocol osi seven or tcp / ip five or tcp / ip four.

We explained the origin and function of each layer in accordance with tcp / ip five, understand the principles of the Internet communications.

  1. The physical layer: mainly transmitting low voltage (electric signal) based on the electrical characteristics, high voltage corresponding to the number 1, a low voltage corresponding to the digital 0

(A simple electrical signal 0 and 1 does not make any sense, it must provide an electrical signal how many bits a groups of what it means)

  1. Data Link Layer: This grouping is used Ethernet protocol.

    1. ethernet provisions

      • A set of electrical signals constitute a data packet, called 'frame'
      • Each data frame is divided into: a header and a data head data of two parts
    2. mac address: source and destination addresses contained in the head Origin: predetermined Ethernet protocol internet access devices must have the card, the transmission and receiver means is address card address, i.e. the address mac

    3. With mac address, two hosts on the same network can communicate with the (host obtains a mac address of another host via arp protocol)

(Ethernet protocol using the most primitive way, way broadcast communication if all communications are broadcast using Ethernet, then a machine to send packets over the world will receive, so that not only inefficient and unrealistic)

  1. Network layer: the introduction of a new address is used to distinguish between different broadcast domain / subnet, this address is the network address
    1. The agreement called network address ip protocol, which defines the address called ip address, v4 version that is widely used ipv4
    2. ip and the packet data is also divided into head portion, i.e. on the basis of the data link layer on layer ip packet header.
    3. By mac address (local area network) + IP address (the Internet) to find unique worldwide computer

(We find by ip and mac with a specific host, how to identify applications on this host, the answer is the port, port application that is associated with the card number.)

  1. Transport Layer: establishing a communication port to port
    1. tcp / udp protocol
    2. mac address (local area network) + IP address (Internet) + port number can be found on the world's only unique computer application
  2. Application Layer: a predetermined data format of the application, the 0 and 1 to the specific features

socket abstraction layer

Socket is an abstraction layer between the application layer and the transport layer, it can be TCP / IP layer of abstraction for the complex operations a few simple interface to supply call has been achieved in the process of communication with the network layer.

Guess you like

Origin www.cnblogs.com/yellowcloud/p/11086758.html