Three elements of network programming model and network programming __ programming

Source: Internet
Author: User

Network Model

The problem of network model research is how to communicate between computer networks.

The network model generally refers to

OSI (Open systeminterconnection System interconnection) Reference Model

TCP/IP Reference Model


Network Model 7 Layer Overview :

1. Physical layer: The main definition of physical equipment standards, such as the interface type of network cable, fiber interface type, the transmission rate of various transmission media. Its main function is to transfer the bit stream (that is, from 1, 0 into the current strength to transmit, to the destination after the conversion to 1, 0, that is, we often say that the analog-to-digital conversion and ADC). This layer of data is called a bit.

2. Data Link layer: Mainly the data received from the physical layer for the MAC address (the address of the network card) package and solution package. This layer of data is often called a frame. The device at this level is the switch, and the data is transmitted through the switch.

3. Network layer: Mainly the data received from the lower level of the IP address (example 192.168.0.1) encapsulation and solution package. The device at this level is a router that often calls this layer of data a packet.

4. Transport Layer: Defines a number of transport data protocol and port number (WWW port 80, etc.), such as: TCP (Transmission Control Protocol, low efficiency, reliability, for transmission of high reliability requirements, large data data), UDP (User Datagram Protocol, contrary to TCP characteristics, For transmission reliability requirements are not high, small data data, such as QQ chat data is transmitted in this way. The main purpose is to segment and transmit the data received from the lower level, and then reorganize it after reaching the destination site. This layer of data is often called a segment.

5. Session Layer: A path for data transmission through the Transport Layer (port number: Transport port and receiving port). Initiate or accept session requests primarily between your systems (devices need to know each other to be IP or Mac or host name)

6. Presentation layer: Mainly for the interpretation of the received data, encryption and decryption, compression and decompression, and so on (that is, the computer can recognize things to convert adults can recognize things (such as pictures, sounds, etc.).

7. Application layer: Mainly some terminal applications, such as FTP (a variety of file downloads), the WEB (ie browsing), QQ and so on (it can be understood as we can see on the computer screen things.) is the terminal application).

Network applications: Network programming, IO streaming, multithreaded composition .

three elements of network programming

IP Address: inetaddress

The identification of the device in the network, not easy to remember, available host name

Port number

Used to identify the logical address of a process, identification of different processes

Transport protocol

Rules for communication

Common agreement: TCP,UDP

IP Address:

Unique identification of the computer.

To facilitate our access to and operation of IP addresses, Java provides a class inetaddress for us to use.

A: The so-called IP address is a 32bit address assigned to each host connected to the Internet. In accordance with the TCP/IP, it is represented by the binary, each IP address is 32bit, and the bit is converted into bytes, which is 4 bytes. For example, a binary form of IP address is "00001010000000000000000000000001", such a long address, people to deal with too much effort. To facilitate the use of people, IP addresses are often written in decimal form, using the symbol "." In the middle. Separates different bytes. As a result, the IP address above can be expressed as "10.0.0.1". This notation for IP addresses is called dotted decimal notation, which is clearly much easier to remember than 1 and 0.

The composition of the B:IP address

IP Address = network number + host address

Class A IP address: the first paragraph number is the network number, the remaining three paragraph number is the local computer number

Class B IP Address: the first two paragraph number is the network number, the remaining two paragraph number is the local computer number

Class C IP Address: The first three segment number is the network number, the remaining part of the number is the local computer number

Special Address:

127.0.0.1 loopback address, which can be used to test whether there is a problem with the local network. Ping 127.0.0.1

DOS command ipconfig: view native IP address

xxx.xxx.xxx.0 Network Address

xxx.xxx.xxx.255 Broadcast Address

Class A 1.0.0.1---127.255.255.254

(1) 10.x.x.x is a private address (the private address is not used on the Internet, but is used in the local Area network address) (2) 127.x.x.x is reserved address, used for cyclic testing.

Class B 128.0.0.1---191.255.255.254 172.16.0.0---172.31.255.255 is a private address. 169.254.X.X is a reserved address.

Class C 192.0.0.1---223.255.255.254 192.168.x.x is a private address (not applicable on the Internet, used in the LAN)

Class D 224.0.0.1---239.255.255.254

Class E 240.0.0.1---247.255.255.254

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.