Stick to learning for 100 days: network programming

preface

Hello, I'm Xiuqi.
On the one hundred and twenty-first day of learning C + +, I barely understood C + + from introduction to mastery. There are still a lot of people who haven't remembered and didn't understand. Let's look ahead first. I've been struggling for a long time today. Finally, I opened a new book to learn network programming. The road is not necessarily right, but I study hard. All the roads I've traveled will be scenery.
Here you can record some learning things and learning mood. The content is mainly some small notes sorted out by yourself.

1, Network programming

TCP/IP Protocol, local network information programming

Multithreading programming, socket programming

Simple web server design

be based on IO Network development of model

Network performance tools iperf Use of

Winlnet Develop browser Http Programming

Web Programming winpcap Programming

ICE Network programming IPv6 programming

2, TCP/IP

1.TCP/IP: Transmission Control Protocol / Internet Protocol < transmission control protocol, Internet Interconnection Protocol > (network communication protocol).
2.TCP/IP protocol refers to a protocol cluster, including multiple network protocols (IP protocol, IMCP protocol, TCP protocol, HTTP protocol, FTP protocol, POP3 protocol, etc.). It does not refer to one agreement or two agreements together.
3.TCP/IP defines the standard of how the computer operating system connects to the Internet and how data is transmitted between them.

3, Hierarchical structure of TCP/IP protocol

1. From top to bottom, the protocol cluster is divided into four layers: application layer, transport layer, Internet layer and network interface layer
2. Application Layer: including all high-level protocols:

Virtual terminal protocol( TELcommunications NETwork,TELNET)Users on one machine log in to the remote machine and work.
File transfer protocol( File Transfer Protocol,FTP)Provides an effective way to move documents from one machine to another.
Email transfer protocol( Simple Mail Transfer Protocol,SMTP)Send and receive e-mail.
Domain name service( Domain Name Service,DNS)Map host names to network addresses.
Network news transmission protocol( Net News Transfer Protocol,NNTP)Release, retrieval and acquisition of news.
Hypertext Transfer Protocol( HyperText Transfer Protocol,HTTP)www Get the home page on.

3. Transport layer: transport layer < where TCP protocol and UDP protocol are located >

.TCP: Transmission control protocol is a connection oriented protocol, which provides reliable message transmission and link service to upper layer applications.
.TCP Reliable guarantee, flow controllable, multiplex, priority and security control.
.UDP: (User Datagram Protocol)User datagram protocol: an unreliable transmission protocol for connectionless.
.UDP: unwanted TCP Sorting and flow control.

4. Internet layer: Internet layer < Internet layer, network layer > the key part of the whole TCP/IP architecture

.It enables the host to send packets to any network and transmit packets to the target independently.
. The order of arrival and transmission of packets will be different through different networks.
. The protocols used are IP(Internet Protocol)Internet Protocol

5. Network interface layer: network interface layer < data link layer > the basic part of the whole architecture

.receive IP Layered IP Data packets are sent and received outward through the network, and the physical frames from the network are processed and extracted IP Packet, to IP Layer send.
.The actual connection layer between the host and the network. Below is the physical line (Ethernet, optical fiber network, etc.).
.There are Ethernet, token ring network and other standards.
.Be responsible for the drive of network card equipment, frame synchronization (what signal is detected from the network cable as the beginning of a new frame), conflict detection (automatic retransmission when a conflict is detected), data error verification, etc.
.Switches are network devices that work in the link layer. (data frames can be forwarded between different link layers (between 10 Gigabit Ethernet and 100 Gigabit Ethernet)/Ethernet and inter token ring.
.The switch removes the incoming data frame and repacks the head of the link layer before forwarding.

6. Different protocol layers have different appellations for the data unit of this layer. Transmission layer: data segment; Abbreviation: segment / network layer: packet; Abbreviation: IP packet, packet / link layer: frame; Abbreviation: data frame.
7. The data is encapsulated into frames and sent to the transmission medium. After reaching the destination host, the corresponding radicals of each layer protocol are stripped off, and finally the application layer data is handed over to the application program for processing.

4, How web pages work

Sender
. browser: www.xxx.com+Press enter to access the web page=>visit Web Web page on server
. Application layer adopts HTTP Protocol, the browser will be composed of website and other information HTTP Data and send it to the next layer
. The transport layer precedes the data TCP Header, marked port 80( Web Server default port) and pass it to the next layer
. The network layer adds the name of its own machine before the data segment IP And purpose IP,This paragraph is called IP Data packet (or message), and IP Package to the next floor
. Network interface layer in IP Add the name of your own machine before the packet MAC Address and purpose MAC Address, then add MAC The address of the frame is called the address of the frame.
. The network interface layer sends the frame to the network in the form of bit stream through the physical network card
 The Internet has a router to read the data in the bitstream IP Address routing, reach the correct network segment, and the switch of the network segment reads the address in the bit stream MAC Address and find the corresponding receiving machine
 Receiver
. The network interface layer uses the network card to receive the bit stream, read the frame and MAC Remove the address, that is IP Data packet, passing to the next network layer
. Network layer reception IP Packet, will IP Remove it from the front of the bag and take it out TCP The data segment is handed over to the transport layer
. The transport layer gets the data segment and knows TCP Marked port 80 indicates that the application layer protocol is HTTP,take TCP Remove the header and give it to the application layer and tell yes HTTP data
. What the application layer sender wants is HTTP Data, calling Web Server program, put www. xxx.com Send back your home page file

5, Small head, big question

application layer
Transport layer
network layer
link layer
term

In case of infringement of the above contents, the contact shall be deleted immediately.
Thank you for reading - thank you for your support

Tags: C++ Programming network Network Protocol

Posted by jmelnick on Fri, 13 May 2022 00:31:56 +0300