Visual C ++ network programming-notes and visual Network Programming
Part 1: Basic knowledge (network)
1. OSI Layer-7 network model: OSI network model is a reference model for Open System Interconnection. It includes 1. Physical hardware layer, 2. data link layer, 3. network layer, 4. Data Transmission Layer, 5. Session Layer, 6. Presentation layer, 7. Application layer. At the sending end of the network communication, each communication layer of its communication data is added to a packet header by the protocol of this layer, while the receiver is the opposite, when the data passes through each layer, the corresponding packet header data is stripped by the layer protocol.
Definition of each network layer
Physical hardware layer: corresponding physical devices, such as network cards
Data link layer: compressing and compressing data
Network Layer: network transmission of transmitted data
Data transmission layer: network transmission of information
Session Layer: establish a physical network connection
Presentation Layer: represents transmitted data in a certain format
Application Layer: Application Interface
2. TCP/IP protocol
The TCP/IP network model has only four layers, including the data link layer, network layer, data transmission layer, and application layer.
Network Layer Definition
Data link layer: network hardware devices and drivers such as NICs
Network Layer: IP protocol and other interconnection protocols
Data transmission layer: Provides communication methods for applications, usually TCP/UDP
Application Layer: processes the actual application layer protocol.
3. C/S Programming Model
Listening process: the server waits for the client connection request to arrive (on a specific IP address and port );
Part 2: Basic knowledge (Network Programming)
1. Socket. The windows socket-related API function is called the winsock function.
Classification of sockets: streaming socket (SOCK_STREAM) and datagram socket (SOCK_DGRAM); among them, streaming socket is specially used for TCP communication applications, datagram socket is used for applications that use UDP protocol for communication.
2. Network byte sequence: stores the most important bytes in data.
3. socket-related classes integrated in MFC
CAsyncSocket class and CSocket class (derived from the former)
What is the name of the most attractive flower shop ??
Ling Cao Ling
Visual c ++ programming learning notes source code Liu chunhui Cd content, mainly Chapter 12th grateful
Ah ah