Design and implementation of sheet transport message points

A data transmission process problems

Sending a file to send can not be canceled

Large file transfer fault rate low

The same connection can not be achieved files, general message priority

 

Second, the fragmentation process data transmission

III fragment as logic implementations

The file size is calculated slices, slice and reads data to

Fixed format data fragments sent packing

Sliced ​​data analysis and fragmentation assembly

Dispatcher adjust scheduling logic

Four, Packet rules

V. fragmentation message rule

Frame size: maximum power of 16 -1 = 65535 (0 occupies one byte, so the maximum identified as 65535) 2, i.e., the maximum frame size is 65535

Frame Type: Indicates whether the frame is the first frame (if led by frame, then create a corresponding frame type according to the type and if not, add data directly.), The abolition of frames, etc.

Frame flag information: for storing encryption information, such as the type of encryption

Uniquely identifies the corresponding packet: a positive number in the range of 1 to 255 (0 is generally not used), such as a head frame carrying the packet is 1, the data frame is 1, then the second packet by the time of carrying labeled 2, the data frame also 2. Upon receiving the labeled 2, then the plug data in the same packet. At this time, message transmission can be achieved concurrent 255.

Reservations: For the possibility of extension

Data area: a frame support

 

Six, Packet new rules

packet comprising a header and a body, led frame header, the frame header data structure shown in FIG.

Baotou content will be added to the data area of ​​a frame, a packet of inclusions tell how long, what type, what packetinfo xenoliths Yes.

Package comprises many frames.

Seven, the data frame Frame structure

 

Eight, the first frame data content

The upper part of the head portion of each frame

Starting Data Length, belong to the data portion.

Data portion, using the length of the first 5 bytes of data storage, 1 byte of storage type of data, 256 bytes of storage headerinfo

 

Nine, the basis of class

Class slice: Frame

AbsSendFrame: base transmit frame

AbsSendPacetFrame: Packet transmission frame basis

SendHeaderFrame: transmitting a head frame

SendEntityFrame: sending entity frame

AbsReceiveFrame: Upon receiving a frame

ReceiveHeaderFrame: receiving a head frame

ReceiveEntityFrame: receiving entity frame

CancelSendFrame: Cancel Send frame

AsyncPacketReader: receiving a management packet, the implementation logic slice

AsyncPacketWriter: receiving a management packet, the implementation logic slice

BytePriorityNode: prioritized node list may be configured for

 

Ten, 类图

XI, the Packet Switch Frame process

 

 

Published 174 original articles · won praise 115 · views 830 000 +

Guess you like

Origin blog.csdn.net/nicolelili1/article/details/104523752