Three elements of network programming

Source: Internet
Author: User

Three elements of network programming:
A:ip Address
B: Port
C: protocol

Example:
I want to speak with Brigitte. Do you have a swollen handle?
A: I want to find Brigitte.
B: Talk to her, say to the ear.
C: What do I say? " I Love You "
However, she did not learn English, do not understand.
I don't need to speak English, I can speak Chinese: I love you.

IP Address:
The unique identity of the computer in the network.

The computer can only recognize binary data, so our IP address should be a binary data.
However, we configure the IP address is not binary, why?
ip:192.168.1.100
Conversion: 11000000 10101000 00000001 01100100
If true: 11000000 10101000 00000001 01100100 words.
If we want to configure the IP address every time we go to class, it will be more difficult to remember.
So, for the convenience of representing an IP address, we convert the data on each byte of the IP address into decimal, and then use the. Separate to indicate:
"Dotted decimal"

IP Address Composition: Network number segment + host number segment
Class A: The first number segment is the network number segment + The third segment of the host number segment
One network number: 256*256*256 = 16777216
Class B: The first second number segment is the network number segment + The last two segment of the host number segment
One network number: 256*256 = 65536
Class C: The first third segment is the network number segment + The following section of the host number segment
One Network number: 256

Classification of IP addresses:
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 a reserved address, used for cyclic testing.
Class B 128.0.0.1---191.255.255.254172.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.254192.168.x.x is a private address
Class D 224.0.0.1---239.255.255.254
Class E 240.0.0.1---247.255.255.254

Two DOS commands:
Ipconfig view native IP address
Ping behind with IP address. Test if there is a problem with the communication between this machine and the specified IP address

Special IP Address:
127.0.0.1 loopback address (indicates native)
x.x.x.255 Broadcast Address
x.x.x.0 Network Address

Port number:
The identity of the program that is running.
Valid ports: 0~65535, where the 0~1024 system uses or retains ports.

Agreement:
Rules of Communication

Udp:
Package the data
Data is limited
Do not establish a connection
Fast speed
Unreliable

Tcp:
Establishing a connection Channel
Unlimited data
Slow speed
Reliable

Example:
UDP: Texting
TCP: Call

Three elements of network programming

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.