Network Programming and threading

Source: Internet
Author: User
Tags dedicated server vps server port

First, the network

(1) Unix and Liunx are the best operating systems for network processing.

(2) The network must have a network card to be able to connect.

(3) The original network route, the Internet and the telephone line into the terminal after a line connected to the home, this line connected to the data separator, divided into ADLs port and telephone, and then received back, into the separator transmission to the terminal to determine the line into the respective.

Second, the network is divided into WAN, metropolitan area network, LAN

China's largest network is the backbone of the country, China Mobile, unicom, telecommunications, are relying on the backbone of the network points down the speed.

1. Wan, with a separate IP address on the backbone network.

2. Metropolitan area Network, a city all connected users share an IP address.

3. LAN, each home network through the router to connect more than one device.

Telecom uses a separate IP address for each household. The IP address of the WAN can be used to communicate with each computer independently.

Third, IP address

(1) IP address: is the address number consisting of numbers.

(2) IP is to determine which computer is.

(3) IP address is divided into IPv4 and IPv6.

(4) Check the computer IP.

(5) Ping is a program, and the other side of the program to do an interaction, if the other side is not open can not successfully check the speed of operation.

Four, port

(1) The port is a number.

(2) The function of a port is used to determine the application of one computer.

(3) How is the port transferred?

There are two computers, the IP of a computer is 11.15.16.222 need to transfer data to 11.15.223, if there is no port, you will not know the data sent to whom to receive. If the upper port is written, the computer will look for the 4040 Port program to transfer.

(4) The port is used to differentiate the network program.

(5) A port can be used for different protocols, but it can not be used for the same protocol. For example, a port 8080 for TCP occupancy can also be used to YDP, but 8080 of this port cannot give two the same protocol occupancy.

(6) More than 4000 of the ports can be requested, 4000 is the system reserved port

V. Port mapping 1. Manual mapping:

(1) There are now two people using a telecommunications network, the access is ADSL dial-up Internet access, the IP address is 55.6.4.2. Another person uses the telecommunications ADSL dial-up Internet connection, but connected to the router IP address is 55.6.4.3, the IP address of a LAN assigned by the router to the computer is 192.168.1.55.

(2) Why 192.168.1.55 computer to find 55.6.4.2 computer is very easy to find? Because 182.168.1.55 this computer, only need to enter 55.6.4.2 this computer's ip:55.6.4.2 and port number 8888 corresponding can be accessed, because 55.6.4.2 is the WAN inside the IP is independent, so it is easy to access.

(3) and when 55.6.4.2 computer want to access 192.168.1.55 computer is very difficult? Because the 55.6.4.2:9999 computer wants to access port 9999 of the 182.168.1.55 computer, because one is the IP address of the WAN, one is the IP address of the LAN, they cannot access each other, and the WAN IP address can only access the IP address of the WAN. If it is access to the 55.6.4.3.9999 is also not possible, because this address is the address of the router and the computer's IP address is not related, so also can not connect.

(4) How to solve the problem of 55.6.4.2 computer connecting 192.168.1.55 computer? There will be something called a forwarding policy in the router. What is a forwarding policy? The forwarding policy is to generate an external port assumption of 19999 on the router, and then let him forward to the 192.168.1.55:9999 port. So that the outside world as long as the input 55.6.4.3.19999 on the router will trigger the forwarding to 192.168.1.55.9999 IP port can receive messages, this is called port mapping.

2. Auto-mapping

(1) Automatic mapping means: Local area network programs to access networks, the router will automatically give you the program with a port map, so that the WAN server can give you a receipt message.

For example a computer to browse the Web, you need to first access the router, router access to fiber-optic cat, fiber cat access to the WAN, WAN Access kaige123 Web server.

The IP address of the computer is 192.168.1.55 in the need to browse the Web page, through the router, the router automatically replaced this IP router IP and need to access the KAIGE123 server port number 20014 that is (61.5.4.3:20014), direct access to the other side of the server, kaige123 the server to transfer the corresponding data back to the router, the router will automatically convert to the computer's IP address, transfer data to the computer.

(2) is a port mapping

Vi. DNS

1.DNS is the domain name resolver, domain name resolution is to query out the IP address of this domain name.

2. How is the domain name parsed?

There will be a domain name parser in the nearest place of the province.

3. Web domain can be bought on the internet

4. In the Web page, such as input http://kaige123.com this domain name, the domain name will be resolved to the IP address query out, and then feedback to the Web system, the system to get this IP will be access to the server, the default port of the page is 80.

5. Domain name tampering?

In the computer, there is a local domain name cache, the domain name is updated every 10 minutes, not updated within 10 minutes. This will reduce the pressure on the server, and some unscrupulous servers will tamper with the local domain name cache.

6. How do I clear the local parsing cache?

Use Ipconfig/flushdns to clearly cache

Seven, DNS intelligent resolution

Parse the nearest server, according to what network, what region, intelligent resolution, distributed to the nearest fastest server.

Eight, China network operators

Unicom's network is the metropolitan area network assigned to each user, users need to access the Unicom server when it is necessary to go through the unicom switch IP address 10.5.6.4 automatically mapped to 61.5.5.4 and then to the Communications Server. The ip:61.5.5.123 of telecommunications is a separate IP address, so you can connect directly to the Communications Server.

(1) This time 10.5.6.4 computer want to connect to 61.5.5.123 computer can it?

Is can be connected to, because the telecommunications each computer is independent of the IP there is no defensive measures.

(2) That 61.5.5.123 computer can be connected to 10.5.6.4 's computer?

This is not, because the telecommunications ip:61.5.5.123 is the WAN, and the computer 10.5.6.4 is connected to the metropolitan area Network, your computer every time to go through the map to the WAN, others want to pass through the port of the Unicom map to directly retrace the information to the computer unicom is not allowed to pass.

Nine, VPN

1.VPN is called a private network.

2.VPN is to use a remote computer to surf the Internet.

3. For example, the current Internet to connect to Facebook is not connected, this time requires VPN technology to connect the host in Hong Kong, using this host to request the current environment of the Facebook page, which is called FQ, but also VPN technology.

VPN servers can be purchased in million-net.

Ten, VPS personal dedicated server

VPS is a virtual server.

Xi. Cluster

1. There are load balancers and firewalls inside the cluster.

2. Load Balancer: Allocate idle requests to idle hosts.

Server is divided into: 1u, 2u, 3u u in the server middle finger is the thickness of the rack-mounted server.

Clustering: Let the servers gather together for more customer service and share customer access.

The benefit of a clustered server is that you can reduce and add servers, and traffic can be transferred to the next server.

3. Firewall: Is the rule that controls whether access is compliant with the firewall, and does not comply with the denial to access. Prevent irregular access.

12. TCP

1.TCP is called a reliable transport protocol, also called a socket.

TCP connection to the server, you can maintain a long time connection is open, just need to ask if you can connect, connect the next can communicate, TCP can absolutely ensure that the data sent to the other computer, if the file is damaged, TCP will be reissued. TGP need each other's computer also online at the same time to transfer files.

2.UDP is called unreliable transmission protocol, also called a message.

UDP is regardless of the other side of the computer is not on the line, just send files, regardless of whether you can receive, the data sent is limited, but the speed is relatively fast.

Network programming and threading

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.