Network programming foundation, the transport layer service

Network Programming Fundamentals 

Computer network functions include sharing of resources, to achieve the rapid transmission of data information. OSI seven-layer model > setting organizations: ISO (International Organization for Standardization) > role: to make network communications workflow standardization > Application Layer: provides user services, application specific functions to achieve > Presentation Layer: optimization of compressed data encryption > Session Layer: Create user-level connection, select the appropriate transmission service > transport layer: providing a transport service   > network layer: routing, internetworking   > link layer: data exchange, controlling the transmission of specific data > physical layer: provides the hardware to ensure that data transmission , network interface, transmission medium > advantage   > 1. establishment of a unified workflow > 2. Division clear, roles, each step is a clear division of > 3. reducing the coupling between the modules to facilitate the development of four layer model (TCP / IP model) background: the actual work can not be fully in accordance with the seven-layer model engineers operating requirements, and gradually evolved into four more in line with the actual situation
    
        

 

 







 




 
 
 

 


Data transmission
   
1. The transmission side application sends a message, header information is added in layers, the final message packet transmitted in the physical layer.
2. The messages transmitted via a plurality of nodes (switches, routers) transmission, a final destination host.
3. resolve the target host header packet layer by layer by the physical layer, the final message to the presentation application.
    

 
Network protocol
        
> network data transmission, follow the rules, including the establishment of what kind of data structure, what kind of special signs.
    
 Concept of network infrastructure          
* IP Address
> functions: determining the position of a route network host
 
> command to view the computer network address: the ifconfig
 
> Structure
>> IPv4 dotted decimal 172.40.91.185 each portion in the range 0--255
>> the IPv6 128 expands the range of addresses
                
     
* domain name
> Definition: the network address from the server name
 
> effect: easy to remember, express certain meanings
 
> ping [ip]: testing and whether a host Unicom


        
* Port number (Port)
> action: the port is part of a network address for the network to distinguish between different host applications.
 
> Features: The listen port a system can not be repeated
 
> Range: 1--65535
>> 1--1023 system or popular application programs listen on port
>> 1024--65535 own port
 
 
transport layer service
 
transport connection-oriented services ( data transmission based on TCP protocol)
 
1. transmission characteristics: provide reliable data transmission, data transmission reliability index no loss, no disorder, error-free, without duplication.
       
2. The means of achieving: Before communication requires a data connection, communication to the end of normal disconnect.
 
> Three-way handshake (a connection)
>> client sends a message packet requesting a connection to a server
>> server receives a request, reply messages can be connected to determine
>> the client receives the reply, send a final message connection is established

                    
> four wave (disconnected)
>> initiative sends a request message to disconnect
>> passive side after the receipt of the request, immediately reply, expressed its readiness to disconnect
>> passive side is ready to send the message again expressed can be disconnected
>> initiative has received the OK to send the message to complete the final off
 

 


 
 
3. 适用情况 : 对数据传输准确性有明确要求,传数文件较大,需要确保可靠性的情况。比如:网页获取,文件下载,邮件收发。
 
 
面向无连接的传输服务(基于UDP协议的数据传输)
 
1. 传输特点 : 不保证传输的可靠性,传输过程没有连接和断开,数据收发自由随意。
 
2. 适用情况 : 网络较差,对传输可靠性要求不高。比如:网络视频,群聊,广播
 

Guess you like

Origin www.cnblogs.com/Alan-Song/p/11181072.html