Socket programming: Computer Network Basics

Source: Internet
Author: User

Before learning about networks, review the basics of computer networks.

Lu Xun said that there is a huge copy of the article in the world. If you have any questions, you can copy the book based on your basic knowledge.


A layered model

1. Why Layer

In order to simplify the network design complexity, communication protocols adopt a layered structure, and Protocols at different layers are mutually independent and efficient in coordination.

The structure of complex communication protocols should be hierarchical. Layered protocols can bring a lot of convenience:
The advantages of layering are:

A> good flexibility: When any layer changes, as long as the interface relationship remains unchanged between the layers, the layers above or below will not be affected.

In addition, the services provided by a layer can be modified. When the services provided by a layer are no longer needed, you can even cancel the layer for easier management.

B> each layer is independent: interfaces are standardized between layers, allowing different products to provide only one part of the functions of each layer. A layer does not need to know how its next layer is implemented,

You only need to know the services provided by the layer through the interface between layers. Since each layer only implements a relatively independent function, it is easier to implement it!


2 layers

Standard layer-7 structure and practical layer-5 Structure


The socket corresponds to the transport layer and network layer.


Introduction to socket 2

Socket is the socket. The most primitive socket is inherited from Unix systems. Later Microsoft launchedWinsocket.

Socket programming involves some concepts such as address, port, and byte order. It is best to understand.

Here we will talk about the socket connection process,



There are roughly three major steps:

1. server listening

2 client request connection

3 Connection Confirmation


The next section describes the specific connection steps in detail.



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.