Computer network FAQs

Source: Internet
Author: User

1. Differences Between TCP and UDP

TCP-the transmission control protocol provides connection-oriented and reliable byte stream services. Before the customer and the server exchange data with each other, a TCP connection must be established between the two parties before data can be transmitted. TCP provides timeout resend, discard duplicate data, test data, traffic control, and other functions to ensure data can be transferred from one end to the other.

UDP-the User Datagram Protocol is a simple datagram-oriented transport layer protocol. UDP does not provide reliability. It only sends the data from the application to the IP layer, but it cannot guarantee that the data can reach the destination. Because UDP does not need to establish a connection between the client and the server before transmitting the datagram, and there is no timeout and re-transmission mechanism, the transmission speed is very fast.

TCP applications: DNS, FTP, SMTP, ssh, telnet, HTTP, POP3

UDP applications: DNS, TFTP, Rip, DHCP, SNMP, and NFS

2. ICMP protocol?

A: ICMP is the Internet Control Message Protocol, which controls the Message Protocol over the Internet. It is a sub-Protocol of the TCP/IP protocol family. It is used to transmit control messages between IP hosts and routers. A Control Message refers to a message of the network itself, such as network connectivity, host accessibility, and vro availability. Although these control messages do not transmit user data, they play an important role in transferring user data. There are two types of ICMP packets: Error Report and inquiry message.


3. What are the implementation principles of vswitches and vrouters? At which level is the implementation implemented?

A: A vswitch is used in a LAN to transmit data using the host's MAC address. It does not need to care about the IP address in the IP data packet. It works on the data link layer. The router uses the IP address of the IP packet to route the route (the next hop router to which the packet is sent ). The router works at the network layer.

 

4. Why TCP three-way handshake and four-way handshake:

Why is the three-way handshake while the four-way handshake when the connection is closed?

This is because the socket in the listen status of the server can respond to ack and SYN after receiving the SYN Packet connection request) it is sent in a message. However, when the connection is closed, when the other party receives the fin Message notification, it only indicates that the other party has no data to send to you; but not all your data may have been sent to the other party, therefore, you may not close the socket immediately, that is, you may need to send some data to the other party, and then send the fin message to the other party to indicate that you agree to close the connection now, therefore, the ACK messages and fin messages are sent separately in most cases.

Why does the time_wait status still need to be returned to the closed status after 2msl?

To understand the second reason for the existence of the time_wait status, we assume that there is a TCP connection between port 1500 of 12.106.32.254 and port 21 of 206.168.112.219. We closed this connection. After a while, we established another connection between the same IP address and port. The next connection is called the embodiment of the previous connection because their IP address and port number are the same. TCP must prevent old repeat groups from a connection from appearing after the connection has been terminated, so it is misunderstood that it belongs to a new body of the same connection. To achieve this, TCP will not initiate a new embodiment for connections in the time_wait status. Since the duration of the time_wait status is 2msl, this is enough for groups in a certain direction to survive at most MSL seconds, and the responses in another direction to survive at most MSL seconds are also discarded. By implementing this rule, we can ensure that every time a TCP connection is established successfully, the old group from the previous embodiment of the connection disappears in the network.
In network programming, how does one enable or disable a connection without passing through the time_wait status? For example, how does one enable the server to restart and use the original IP address and port during 2msl?
You can use the setsockopt system call to set the so_reuseaddr option for the socket. The socket can be reused. This socket option notifies the kernel. If the port is busy but the TCP status is in time_wait, You can reuse the port. If you want to restart your service program immediately after it is stopped, and the new socket still uses the same port, the so_reuseaddr option is very useful at this time.

5. What is the comparison between circuit switching, packet switching, and group switching?

A: Circuit Switching: both the Public Telephone Network (PSTN) and the mobile network (including GSM and CDMA) Adopt the circuit switching technology. The basic feature of this technology is connection-oriented, before communication between the two parties, a communication circuit with fixed bandwidth needs to be allocated to the two parties. The two parties continue to occupy the allocated resources during the communication until the communication ends. The advantage of this method is that in the communication process, sufficient bandwidth can be provided for the user, and the real-time performance is strong, the latency is small, and the switching device cost is low, however, the disadvantage is that the network bandwidth utilization is not high. Once the circuit is established, no matter whether the communication parties are in the call status, the allocated circuit is always occupied. Connection establishment-data transmission-release Link

Packet Exchange: similar to group exchange, the storage and forwarding mechanism is also used. However, the packet exchange is based on the packet as the transmission unit. Due to the large difference in the packet length, long packets may cause great latency, and it is difficult to allocate the buffer for each node. To meet the needs of various long packets and achieve high efficiency, the node needs to allocate a buffer of different sizes. Otherwise, data transmission may fail.

Group switching: the circuit switching technology is mainly applicable to businesses related to voice transmission. This network switching method has great limitations for data businesses. First, data communication has a strong burstable nature. The peak bit rate and the average bit rate differ greatly. If circuit switching technology is used, if the peak bit rate is allocated, the circuit bandwidth will cause a great waste of resources, if the bandwidth is allocated at the average bit rate, it will cause a large amount of data loss. Second, compared with the voice service, the data service has no strict requirements on latency, but requires error-free transmission, however, voice signals may be distorted but real-time. The group exchange technology is a kind of exchange method based on the characteristics of data communication services. Its basic feature is to adopt the storage forwarding Method for connectionless data communication, divide the data to be transmitted into many small pieces of data according to a certain length, and add the corresponding header fields used for data selection and verification before the data, as the basic unit of data transmission, group. Using the group exchange technology, you do not need to establish a connection before communication. Each node first accepts the Group sent by the previous node and stores it in the buffer zone, then, select an appropriate link based on the address information in the group header and send it to the next node. In this way, you can dynamically allocate bandwidth based on your requirements and network capabilities during the communication process. Group switching is more efficient than circuit switching, but has a high latency. Problems brought about by group forwarding: queuing delay and overhead increase.


6. Differences between select and epoll system calls

Comparison of Supported file descriptors, usage methods, methods that do not need to be repeatedly added to the kernel, methods that obtain active descriptors, and whether et mode is supported


Computer network FAQs

Related Article

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.