QUAKE Network Part Summary: (1) Network section is divided into two parts: (2) The transfer section is divided into two parts: local packet transmission and off-site packet transmission. (3) Local packet transmission by NET_SENDLOOPBACKPACKET () Responsible. (4) Off-site packet transmission is responsible by sys_sendpacket (). (5) Packet Transmission can be divided into single-package transmission and multi-package transmission. (6) NET_SENDPACKET () can transfer local or differently no more than one package size Packet. (7) NetChan_Transmit () Select the transmission mode according to the size of the packet, if the data package is greater than a packet size, then call the netchan_transmitnextfragment () function, the data block will be transferred (MAX_MSGLEN) ) Cut into a packet of a number (MAX_PACKETLEN - 100), then start net_sendpacket () transfer. Otherwise, if the data packet is less than a package, then directly call NET_SENDPACKET () transfer. The above data packet is transmitted before the NET_SENDPACKET () They will be encrypted by Netchan_SCRamblePacket () (data in disruption), then use cl_netchan_encode () to encode it. This is a multi-package transmission. From the above instructions, it can be seen that in fact the multi-package transmission is ultimately transformed into single package transmission . (8) Packet reception is also divided into local packet reception and off-site packet reception. (9) Local packet reception: NET_GETLOOPBACKPACKET () (10) Off-site packet reception: sys_getpacket () (11) When the system receives an off-site The se_packet event is triggered when the packet is reached when COM_EVENTLOOP (), starts the CL_PACKETEVENT () to process the data packet transferred from the client, start the SV_PACKETEVENT () handling the data package transferred by the server. Cl_packetevent () CL_Netchan_Process () cl_netchan_process () cl_netchan_process () Netchan_Process () SV_PacketEvent () SV_Netchan_Process () Netchan_Process () more than those for data packets, referred CL_Netchan_Process () or SV_Netchan_Process () to deal with, it will wait until all packets are down after receiving a call Netchan_UnScramblePacket () decryption, Then use cl_netch An_Decode () decoding. Finally, the last user can read the full packet. (12) Start CL_PACKETEVENT () or sv_packetevent () or sv_packetevent () or SV_PACKETEVENT () and does not need to wait for the package when the system receives the local packet. Because these packets do not enter the network Well (NET_GETLOOPBACKPACKET (NS_GETLOOPBACKPACKET) While (NS_GETLOPBACKPACKET) While (NS_GETLOOPBACKPACKET ", the loop above the entire cut package can be read all in one. (13) Direct delivery of data directly The function has net_outofbandprint () net_sendpacket () Note: The packets transmitted with Net_OutOfBandPrint (), the first four bytes must be fffffff, ie -1. They will be processed by SV_ConnectionLesSpacket () and Cl_ConnectionLESSPACKET ().