[go: up one dir, main page]

CN115134049A - Communication method and device - Google Patents

Communication method and device Download PDF

Info

Publication number
CN115134049A
CN115134049A CN202110315648.8A CN202110315648A CN115134049A CN 115134049 A CN115134049 A CN 115134049A CN 202110315648 A CN202110315648 A CN 202110315648A CN 115134049 A CN115134049 A CN 115134049A
Authority
CN
China
Prior art keywords
window
packet
layer
message
tcp
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110315648.8A
Other languages
Chinese (zh)
Inventor
张金明
吴伟民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110315648.8A priority Critical patent/CN115134049A/en
Publication of CN115134049A publication Critical patent/CN115134049A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/19Flow control; Congestion control at layers above the network layer
    • H04L47/193Flow control; Congestion control at layers above the network layer at the transport layer, e.g. TCP related

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Communication Control (AREA)

Abstract

The application provides a communication method and device, which can solve the problem that the message sending rate of a client is reduced and can be applied to a communication system. The communication method is applied to first equipment, the first equipment comprises a TCP layer and an intermediate layer, and the intermediate layer is a lower layer of the TCP layer. The communication method comprises the following steps: the middle layer receives a first message from the second device. Wherein the first message instructs the TCP layer to retransmit the first data. The intermediate layer sends the first data to the second device and discards the first message. Thus, when receiving the indication of retransmitting the lost message, the intermediate layer not only can retransmit the lost message, but also can filter the indication, and the TCP layer is prevented from receiving the indication. Therefore, under the condition that a channel between the client and the server is not congested and a message is lost occasionally, the TCP layer cannot reduce a congestion window and reduce the message sending rate.

Description

通信方法及装置Communication method and device

技术领域technical field

本申请涉及通信领域,尤其涉及一种通信方法及装置。The present application relates to the field of communication, and in particular, to a communication method and device.

背景技术Background technique

传输控制协议(transmission control protocol,TCP)是一种面向连接的、可靠的、基于字节流的传输层通信协议。TCP的可靠性主要由重传机制实现,具体地,当客户端(例如,手机)向服务端(例如,服务器)发送的报文丢失时,服务端可以指示客户端重传丢失报文。Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte stream-based transport layer communication protocol. The reliability of TCP is mainly achieved by the retransmission mechanism. Specifically, when a packet sent by a client (eg, a mobile phone) to a server (eg, a server) is lost, the server may instruct the client to retransmit the lost packet.

目前,若丢失报文,客户端不仅会重传丢失报文,还会大幅减小拥塞窗口,从而导致客户端的发送窗口减小,进而降低报文发送速率。也即是说,丢包会导致客户端的报文发送速率下降。At present, if a packet is lost, the client not only retransmits the lost packet, but also greatly reduces the congestion window, which reduces the client's sending window and reduces the packet sending rate. That is to say, packet loss will cause the client's packet sending rate to drop.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种通信方法及装置,能够解决客户端的报文发送速率下降的问题。Embodiments of the present application provide a communication method and device, which can solve the problem of a decrease in the packet sending rate of the client.

为达到上述目的,本申请采用如下技术方案:To achieve the above object, the application adopts the following technical solutions:

第一方面,提供一种通信方法。该通信方法应用于第一设备,第一设备包括TCP层和中间层,中间层为TCP层的下层。该通信方法包括:中间层接收来自第二设备的第一报文。其中,第一报文指示TCP层重传第一数据。中间层向第二设备发送第一数据,并丢弃第一报文。In a first aspect, a communication method is provided. The communication method is applied to a first device, where the first device includes a TCP layer and an intermediate layer, and the intermediate layer is a lower layer of the TCP layer. The communication method includes: an intermediate layer receives a first packet from a second device. The first packet instructs the TCP layer to retransmit the first data. The middle layer sends the first data to the second device and discards the first packet.

基于第一方面所述的通信方法,接收到重传丢失报文的指示时,中间层不仅可以重传丢失报文,还可以过滤该指示,避免TCP层接收到该指示。这样,在客户端与服务端之间的信道并未拥塞的情况下,偶尔丢失报文时,TCP层不会减小拥塞窗口,降低报文发送速率。Based on the communication method described in the first aspect, when receiving the instruction to retransmit the lost packet, the intermediate layer can not only retransmit the lost packet, but also filter the instruction to prevent the TCP layer from receiving the instruction. In this way, when the channel between the client and the server is not congested, when packets are occasionally lost, the TCP layer will not reduce the congestion window and reduce the packet sending rate.

一种可能的设计方案中,在中间层接收来自第二设备的第一报文之前,第一方面所述的通信方法还可以包括:中间层缓存来自TCP层,和/或,第二设备的报文。如此,可以提供一种中间层从缓存(也可以称为缓冲区)中读出丢失报文,并重传丢失报文的实现方式,并能够提升中间层重传报文的效率。In a possible design solution, before the middle layer receives the first packet from the second device, the communication method described in the first aspect may further include: the middle layer buffers the message from the TCP layer, and/or, the second device message. In this way, an implementation manner in which the intermediate layer reads out the lost packets from the cache (also referred to as a buffer) and retransmits the lost packets can be provided, and the efficiency of the intermediate layer retransmission of the packets can be improved.

一种可能的设计方案中,上述的中间层接收来自第二设备的第一报文,可以包括:中间层确定所有来自第二设备的报文中确认号相同的多个确认报文。中间层确定该多个确认报文中的第n个确认报文为第一报文,n可以为大于或等于2的整数。换句话说,接收到来自第二设备的相同确认报文个数达到n个时,中间层确认接收到重传丢失报文的指示。这样,可以避免过快重传仍在网络中传输且能被服务端接收的报文,减少重传的次数。In a possible design solution, the above-mentioned intermediate layer receiving the first packet from the second device may include: the intermediate layer determining multiple confirmation packets with the same confirmation number in all the packets from the second device. The intermediate layer determines that the nth confirmation message in the plurality of confirmation messages is the first message, and n may be an integer greater than or equal to 2. In other words, when the number of the same acknowledgment packets received from the second device reaches n, the intermediate layer acknowledges the reception of the indication of retransmission of the lost packets. In this way, it is possible to avoid retransmitting the packets that are still transmitted in the network and can be received by the server, and reduce the number of retransmissions.

可选地,n可以为2。这样,与接收到超过3个重传指示才重传丢失报文相比,在第一次接收到重传指示时,中间层可以立即在缓存中找到丢失报文,并进行重传,从而可以更快地重传丢失报文,提升重传数据的效率。Optionally, n can be 2. In this way, compared with retransmitting the lost packet after receiving more than 3 retransmission instructions, when the retransmission instruction is received for the first time, the intermediate layer can immediately find the lost packet in the cache and retransmit it, so that it can Retransmit lost packets faster and improve the efficiency of data retransmission.

一种可能的设计方案中,第一方面所述的通信方法还可以包括:中间层接收第二报文,第二报文包括第一窗口指示信息,第一窗口指示信息指示第一窗口的长度。中间层发送第三报文,第三报文包括第二窗口指示信息,第二窗口指示信息指示第二窗口的长度,第二窗口的长度大于或等于第一窗口的长度。换句话说,在TCP层向第二设备发送携带窗口指示信息的报文,和/或,第二设备向TCP层发送携带窗口指示信息的报文时,中间层均可以放大该携带窗口指示信息的报文中的窗口的长度,并转发修改后的报文。这样,可以使得TCP层,和/或,第二设备认为数据接收方的接收缓存充足,从而使得TCP层,和/或,第二设备以较大的发送窗口、更高的发送速率向数据接收方发送数据,能够提高传输速率。In a possible design solution, the communication method described in the first aspect may further include: the middle layer receives a second packet, the second packet includes first window indication information, and the first window indication information indicates the length of the first window. . The middle layer sends a third packet, where the third packet includes second window indication information, where the second window indication information indicates the length of the second window, and the length of the second window is greater than or equal to the length of the first window. In other words, when the TCP layer sends a packet carrying window indication information to the second device, and/or when the second device sends a packet carrying window indication information to the TCP layer, the intermediate layer can amplify the window indication information. the length of the window in the message, and forward the modified message. In this way, the TCP layer and/or the second device can be made to consider that the receiving buffer of the data receiver is sufficient, so that the TCP layer and/or the second device can receive the data with a larger sending window and a higher sending rate. It can improve the transmission rate by sending data.

可选地,上述第一窗口指示信息可以包括第一窗口缩放因子字段和第一窗口大小字段,第二窗口指示信息可以包括第二窗口缩放因子字段和第二窗口大小字段。第二窗口的长度大于或等于第一窗口的长度,可以包括如下一项或多项:第二窗口缩放因子字段的值大于或等于第一窗口缩放因子字段的值,或者,第二窗口大小字段的值大于或等于第一窗口大小字段的值。Optionally, the first window indication information may include a first window scaling factor field and a first window size field, and the second window indication information may include a second window scaling factor field and a second window size field. The length of the second window is greater than or equal to the length of the first window, and may include one or more of the following: the value of the second window scaling factor field is greater than or equal to the value of the first window scaling factor field, or, the second window size field The value of is greater than or equal to the value of the first window size field.

可选地,上述第二窗口可以为第二设备的接收窗口。上述中间层接收第二报文,可以包括:中间层接收来自第二设备的第二报文。中间层发送第三报文,可以包括:中间层向TCP层发送第三报文,第二窗口指示信息用于确定第一设备的发送窗口。换句话说,中间层可以截取第二设备向TCP层发送的第二报文,并将第二报文中的第一窗口修改为第二窗口,以及将修改后的第二报文作为第三报文向TCP层发送。由于第三报文中的第二窗口的长度大于或等于第一窗口的长度,因此TCP层会认为第二设备的接收缓存充足,从而以较大的发送窗口、更高的发送速率向第二设备发送数据,进而能够提高传输速率。其中,第二报文中的第一窗口可以理解为第二设备未被修改的接收窗口,第三报文中的第二窗口可以理解为第二设备修改后的接收窗口。Optionally, the above-mentioned second window may be a receiving window of the second device. The foregoing intermediate layer receiving the second packet may include: the intermediate layer receiving the second packet from the second device. The middle layer sending the third packet may include: the middle layer sending the third packet to the TCP layer, and the second window indication information is used to determine the sending window of the first device. In other words, the middle layer can intercept the second packet sent by the second device to the TCP layer, modify the first window in the second packet to the second window, and use the modified second packet as the third The message is sent to the TCP layer. Since the length of the second window in the third packet is greater than or equal to the length of the first window, the TCP layer will consider that the receiving buffer of the second device is sufficient, so that a larger sending window and a higher sending rate are used to send the second device to the second device. The device sends data, which in turn can increase the transfer rate. The first window in the second packet can be understood as an unmodified receiving window of the second device, and the second window in the third packet can be understood as a modified receiving window by the second device.

进一步地,第一方面所述的通信方法还可以包括:中间层依据第一窗口指示信息所指示的第一窗口的长度向第二设备发送数据报文。例如,接收到来自TCP层的数据报文时,中间层可以将这些数据报文存储在缓存中,并且,中间层还可以按第一窗口指示信息所指示的第一窗口的长度向第二设备发送数据报文。由于第一窗口的长度是第二设备未被修改的接收窗口,从而可以避免因数据过多而导致第二设备的接收窗口过载出错。Further, the communication method described in the first aspect may further include: the middle layer sends a data packet to the second device according to the length of the first window indicated by the first window indication information. For example, when receiving data packets from the TCP layer, the intermediate layer can store these data packets in the cache, and the intermediate layer can also send the data packets to the second device according to the length of the first window indicated by the first window indication information. Send data packets. Since the length of the first window is the unmodified receiving window of the second device, it is possible to avoid an overload error of the receiving window of the second device caused by too much data.

可选地,上述第二窗口可以为第一设备的接收窗口。上述中间层接收第二报文,可以包括:中间层接收来自TCP层的第二报文。中间层发送第三报文,可以包括:中间层向第二设备发送第三报文,第二窗口指示信息用于确定第二设备的发送窗口。换句话说,中间层可以截取TCP层向第二设备发送的第二报文,并将第二报文中的第一窗口修改为第二窗口,以及将修改后的第二报文作为第三报文向第二设备发送。由于第三报文中的第二窗口的长度大于或等于第一窗口的长度,因此第二设备会认为TCP层的接收缓存充足,从而以较大的发送窗口、更高的发送速率向TCP层发送数据,进而能够提高传输速率。其中,第二报文中的第一窗口可以理解为TCP层未被修改的接收窗口,第三报文中的第二窗口可以理解为TCP层修改后的接收窗口。Optionally, the above-mentioned second window may be a receiving window of the first device. The foregoing intermediate layer receiving the second packet may include: the intermediate layer receiving the second packet from the TCP layer. Sending the third packet by the middle layer may include: the middle layer sending the third packet to the second device, and the second window indication information is used to determine the sending window of the second device. In other words, the middle layer can intercept the second packet sent by the TCP layer to the second device, modify the first window in the second packet to the second window, and use the modified second packet as the third The message is sent to the second device. Since the length of the second window in the third packet is greater than or equal to the length of the first window, the second device considers that the receiving buffer of the TCP layer is sufficient, and sends the data to the TCP layer with a larger sending window and a higher sending rate. Data is sent, which in turn can increase the transmission rate. The first window in the second packet can be understood as the unmodified receiving window of the TCP layer, and the second window in the third packet can be understood as the receiving window after the TCP layer has been modified.

进一步地,第一方面所述的通信方法还可以包括:中间层依据第一窗口指示信息所指示的第一窗口的长度向TCP层发送该数据报文。例如,接收到来自第二设备的数据报文时,中间层可以将这些数据报文存储在缓存中,并且,中间层还可以按第一窗口指示信息所指示的第一窗口的长度向TCP层发送数据报文。由于第一窗口的长度是TCP层未被修改的接收窗口,从而可以避免因数据过多而导致TCP层的接收窗口过载出错。Further, the communication method described in the first aspect may further include: the middle layer sends the data packet to the TCP layer according to the length of the first window indicated by the first window indication information. For example, when receiving data packets from the second device, the intermediate layer may store these data packets in the cache, and the intermediate layer may also send the data packets to the TCP layer according to the length of the first window indicated by the first window indication information. Send data packets. Since the length of the first window is the unmodified receiving window of the TCP layer, it is possible to avoid an overload error of the receiving window of the TCP layer caused by too much data.

可选地,上述第二窗口指示信息可以由第二报文对应的业务确定。例如,接收第二报文之后,中间层确定第二报文中的五元组信息。其中,该五元组信息分别与业务和窗口的长度对应。中间层根据该五元组信息对应的窗口的长度确定第三报文。如此,中间层可以根据业务修改报文中的窗口指示信息,从而修改业务对应的上行窗口或下行窗口的长度,例如,可以将吞吐量大的业务对应的上行窗口或下行窗口调大,将吞吐量小的业务对应的上行窗口或下行窗口调小。这样,可以使得不同业务的数据传输速率以及传输时延更加合理。Optionally, the above-mentioned second window indication information may be determined by the service corresponding to the second packet. For example, after receiving the second packet, the intermediate layer determines the quintuple information in the second packet. The quintuple information corresponds to the length of the service and the window, respectively. The middle layer determines the third packet according to the length of the window corresponding to the quintuple information. In this way, the middle layer can modify the window indication information in the message according to the service, thereby modifying the length of the uplink window or downlink window corresponding to the service. The uplink window or downlink window corresponding to the small-volume service is reduced. In this way, the data transmission rate and transmission delay of different services can be made more reasonable.

一种可能的设计方案中,第一方面所述的通信方法还可以包括:中间层接收来自第二设备的第四报文。其中,第四报文可以为确认报文。中间层判断中间层已接收的所有确认报文中是否存在第五报文。其中,第五报文的确认号与第四报文的确认号相同。若中间层已接收的所有确认报文中不存在第五报文,则中间层向TCP层发送第四报文。这样,TCP层可以根据确认报文中的确认号向第二设备发送下一个数据报文。In a possible design solution, the communication method described in the first aspect may further include: the middle layer receives the fourth packet from the second device. The fourth message may be an acknowledgement message. The intermediate layer determines whether there is a fifth packet in all the confirmation packets received by the intermediate layer. The confirmation number of the fifth message is the same as the confirmation number of the fourth message. If the fifth packet does not exist in all the confirmation packets received by the intermediate layer, the intermediate layer sends the fourth packet to the TCP layer. In this way, the TCP layer can send the next data packet to the second device according to the acknowledgment number in the acknowledgment packet.

一种可能的设计方案中,中间层位于TCP层与网际互连协议(internet protocol,IP)层之间。参照图7,当中间层位于TCP层与网络层中的IP层之间时,中间层接收到的报文为TCP报文,中间层可以分析该TCP报文;当中间层为IP层的下层时,中间层接收到的报文为IP报文,中间层需要先解析IP报文的头部,从IP报文中提取TCP报文,再分析该TCP报文。换句话说,中间层位于TCP层与IP层之间,能够减少中间层解析报文的开销,从而提高处理效率。In a possible design solution, the middle layer is located between the TCP layer and the internet protocol (internet protocol, IP) layer. 7, when the middle layer is located between the TCP layer and the IP layer in the network layer, the message received by the middle layer is a TCP message, and the middle layer can analyze the TCP message; when the middle layer is the lower layer of the IP layer When the packet is received by the intermediate layer, the packet is an IP packet. The intermediate layer needs to parse the header of the IP packet, extract the TCP packet from the IP packet, and then analyze the TCP packet. In other words, the intermediate layer is located between the TCP layer and the IP layer, which can reduce the overhead of parsing packets by the intermediate layer, thereby improving processing efficiency.

一种可能的设计方案中,第一方面所述的通信方法还可以包括:第一时间段内,收到不同确认号的第一报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,中间层向TCP层发送第一消息。其中,第一消息用于指示TCP层降低发送速率。这样,客户端与服务端之间的信道拥塞时,中间层可以向TCP层反馈重传丢失报文的指示,使得TCP层减小拥塞窗口,降低报文发送速率,避免客户端与服务端之间的信道进一步拥塞,并改善信道质量。In a possible design solution, the communication method described in the first aspect may further include: within the first time period, the number of first packets received with different acknowledgment numbers exceeds the congestion threshold, and/or the packet loss rate reaches When the packet loss threshold is reached, the middle layer sends the first message to the TCP layer. The first message is used to instruct the TCP layer to reduce the sending rate. In this way, when the channel between the client and the server is congested, the middle layer can feed back the indication of retransmission of lost packets to the TCP layer, so that the TCP layer can reduce the congestion window, reduce the packet sending rate, and avoid the communication between the client and the server. further congestion of the inter-channel channel and improve the channel quality.

一种可能的设计方案中,第一报文携带选择确认SACK选项,SACK选项用于指示重传第一数据。其中,SACK选项可以指示哪些数据报文未被接收,哪些数据报文被接收。例如,假设SACK选项用于指示:未接收到序号为100、300、400的数据报文,已接收到序号为200、500的数据报文,那么中间层收到携带该SACK选项的第一报文时,可以确定序号为100、300、400的数据报文可能丢失,从而可以一次性地重传这多个数据报文,而不是逐个重传,避免服务端因等待时间长而出现连接超时,提高客户端的重传效率。In a possible design solution, the first packet carries a selection acknowledgment SACK option, and the SACK option is used to indicate retransmission of the first data. Among them, the SACK option can indicate which data packets are not received and which data packets are received. For example, assuming that the SACK option is used to indicate that data packets with sequence numbers 100, 300, and 400 have not been received, and data packets with sequence numbers 200 and 500 have been received, then the intermediate layer receives the first packet carrying the SACK option. It can be determined that the data packets with serial numbers 100, 300, and 400 may be lost, so that these multiple data packets can be retransmitted at one time instead of one by one to avoid connection timeout due to long waiting time on the server side. , to improve the retransmission efficiency of the client.

第二方面,提供一种通信装置。该通信装置包括:处理模块和收发模块。处理模块包括通信装置的传输控制协议TCP层和中间层,中间层为TCP层的下层。其中,通信装置的中间层,用于利用收发模块接收来自第二设备的第一报文,第一报文指示TCP层重传第一数据。通信装置的中间层,还用于丢弃第一报文,并利用收发模块向第二设备发送第一数据。In a second aspect, a communication device is provided. The communication device includes: a processing module and a transceiver module. The processing module includes a transmission control protocol TCP layer and an intermediate layer of the communication device, and the intermediate layer is the lower layer of the TCP layer. Wherein, the middle layer of the communication device is configured to use the transceiver module to receive the first packet from the second device, where the first packet instructs the TCP layer to retransmit the first data. The middle layer of the communication device is further configured to discard the first packet, and use the transceiver module to send the first data to the second device.

一种可能的设计方案中,通信装置的中间层,还用于缓存来自TCP层,和/或,第二设备的报文。In a possible design solution, the middle layer of the communication device is further configured to buffer the packets from the TCP layer and/or the second device.

一种可能的设计方案中,通信装置的中间层,还用于确定所有来自第二设备的报文中确认号相同的多个确认报文。通信装置的中间层,还用于确定该多个确认报文中的第n个确认报文为第一报文,n可以为大于或等于2的整数。In a possible design solution, the middle layer of the communication device is further configured to determine a plurality of acknowledgment packets with the same acknowledgment number in all packets from the second device. The middle layer of the communication device is further configured to determine that the nth confirmation message in the plurality of confirmation messages is the first message, and n may be an integer greater than or equal to 2.

可选地,n可以为2。Optionally, n can be 2.

一种可能的设计方案中,通信装置的中间层,还用于利用收发模块接收第二报文。其中,第二报文可以包括第一窗口指示信息,第一窗口指示信息指示第一窗口的长度。通信装置的中间层,还用于利用收发模块发送第三报文。其中,第三报文可以包括第二窗口指示信息,第二窗口指示信息指示第二窗口的长度,第二窗口的长度大于或等于第一窗口的长度。In a possible design solution, the middle layer of the communication device is further configured to receive the second message by using the transceiver module. The second packet may include first window indication information, where the first window indication information indicates the length of the first window. The middle layer of the communication device is also used for sending the third message by using the transceiver module. The third packet may include second window indication information, where the second window indication information indicates the length of the second window, and the length of the second window is greater than or equal to the length of the first window.

可选地,第一窗口指示信息可以包括第一窗口缩放因子字段和第一窗口大小字段,第二窗口指示信息可以包括第二窗口缩放因子字段和第二窗口大小字段。第二窗口的长度大于或等于第一窗口的长度,可以包括如下一项或多项:第二窗口缩放因子字段的值大于或等于第一窗口缩放因子字段的值,或者,第二窗口大小字段的值大于或等于第一窗口大小字段的值。Optionally, the first window indication information may include a first window scaling factor field and a first window size field, and the second window indication information may include a second window scaling factor field and a second window size field. The length of the second window is greater than or equal to the length of the first window, and may include one or more of the following: the value of the second window scaling factor field is greater than or equal to the value of the first window scaling factor field, or, the second window size field The value of is greater than or equal to the value of the first window size field.

可选地,上述第二窗口可以为第二设备的接收窗口。通信装置的中间层,还用于利用收发模块接收来自第二设备的第二报文。通信装置的中间层,还用于利用收发模块向TCP层发送第三报文,第二窗口指示信息用于确定通信装置的发送窗口。Optionally, the above-mentioned second window may be a receiving window of the second device. The middle layer of the communication device is further configured to receive the second message from the second device by using the transceiver module. The middle layer of the communication device is further configured to send a third message to the TCP layer by using the transceiver module, and the second window indication information is used to determine the sending window of the communication device.

进一步地,通信装置的中间层,还用于利用收发模块并依据第一窗口指示信息所指示的第一窗口的长度向第二设备发送数据报文。Further, the middle layer of the communication device is further configured to use the transceiver module to send a data packet to the second device according to the length of the first window indicated by the first window indication information.

可选地,上述第二窗口可以为通信装置的接收窗口。通信装置的中间层,还用于利用收发模块接收来自TCP层的第二报文。通信装置的中间层,还用于利用收发模块向第二设备发送第三报文,第二窗口指示信息用于确定第二设备的发送窗口。Optionally, the above-mentioned second window may be a receiving window of the communication device. The middle layer of the communication device is further configured to receive the second message from the TCP layer by using the transceiver module. The middle layer of the communication device is further configured to use the transceiver module to send a third message to the second device, and the second window indication information is used to determine the sending window of the second device.

进一步地,通信装置的中间层,还用于利用收发模块并依据所指示的第一窗口的长度向TCP层发送该数据报文。Further, the middle layer of the communication device is further configured to send the data packet to the TCP layer by using the transceiver module and according to the indicated length of the first window.

可选地,上述第二窗口指示信息可以由第二报文对应的业务确定。Optionally, the above-mentioned second window indication information may be determined by the service corresponding to the second packet.

一种可能的设计方案中,通信装置的中间层,还用于利用收发模块接收来自第二设备的第四报文。其中,第四报文为确认报文。通信装置的中间层,还用于判断中间层已接收的所有确认报文中是否存在第五报文。其中,第五报文的确认号与第四报文的确认号相同。通信装置的中间层,还用于若中间层已接收的所有确认报文中不存在第五报文,则利用收发模块向TCP层发送第四报文。In a possible design solution, the middle layer of the communication device is further configured to receive the fourth message from the second device by using the transceiver module. The fourth message is an acknowledgement message. The middle layer of the communication device is further configured to judge whether there is a fifth message in all the confirmation messages received by the middle layer. The confirmation number of the fifth message is the same as the confirmation number of the fourth message. The middle layer of the communication device is further configured to use the transceiver module to send the fourth message to the TCP layer if the fifth message does not exist in all the confirmation messages received by the middle layer.

一种可能的设计方案中,中间层位于TCP层与IP层之间。In a possible design solution, the middle layer is located between the TCP layer and the IP layer.

一种可能的设计方案中,通信装置的中间层,还用于在第一时间段内收到不同确认号的第一报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,利用收发模块向TCP层发送第一消息。其中,第一消息用于指示TCP层降低发送速率。In a possible design solution, the middle layer of the communication device is further configured to receive, within the first time period, the number of first packets with different acknowledgment numbers exceeding the congestion threshold, and/or the packet loss rate reaching the packet loss threshold When the sending and receiving module is used, the first message is sent to the TCP layer. The first message is used to instruct the TCP layer to reduce the sending rate.

一种可能的设计方案中,第一报文携带选择确认SACK选项,SACK选项用于指示重传第一数据。In a possible design solution, the first packet carries a selection acknowledgment SACK option, and the SACK option is used to indicate retransmission of the first data.

可选地,收发模块可以包括接收模块和发送模块。其中,发送模块用于实现通信装置的发送功能,接收模块用于实现通信装置的接收功能。Optionally, the transceiver module may include a receiving module and a sending module. Wherein, the sending module is used for realizing the sending function of the communication device, and the receiving module is used for realizing the receiving function of the communication device.

可选地,第二方面所述的通信装置还可以包括存储模块,该存储模块存储有程序或指令。当处理模块执行该程序或指令时,使得该通信装置可以执行第一方面所述的通信方法。Optionally, the communication device according to the second aspect may further include a storage module, where the storage module stores programs or instructions. When the processing module executes the program or the instruction, the communication device can execute the communication method described in the first aspect.

需要说明的是,第二方面所述的通信装置可以是第一设备(如手机、服务器等),也可以是可设置于第一设备的芯片(系统)或其他部件或组件,还可以是包含第一设备的装置,本申请对此不做限定。It should be noted that the communication device described in the second aspect may be a first device (such as a mobile phone, a server, etc.), a chip (system) or other components or components that can be provided in the first device, or a The device of the first device is not limited in this application.

此外,第二方面所述的通信装置的技术效果可以参考第一方面所述的通信方法的技术效果,此处不再赘述。In addition, for the technical effect of the communication apparatus described in the second aspect, reference may be made to the technical effect of the communication method described in the first aspect, which will not be repeated here.

第三方面,提供一种通信装置。该通信装置包括:处理器,该处理器与存储器耦合,存储器用于存储计算机程序;处理器用于执行存储器中存储的计算机程序,以使得该通信装置执行第一方面中可能的实现方式所述的通信方法。In a third aspect, a communication device is provided. The communication device includes: a processor, which is coupled with a memory, and the memory is used for storing a computer program; the processor is used for executing the computer program stored in the memory, so that the communication device executes the possible implementations described in the first aspect communication method.

在一种可能的设计中,第三方面所述的通信装置还可以包括收发器。该收发器可以为收发电路或输入/输出接口。所述收发器可以用于该通信装置与其他通信装置通信。In a possible design, the communication device described in the third aspect may further include a transceiver. The transceiver may be a transceiver circuit or an input/output interface. The transceiver may be used for the communication device to communicate with other communication devices.

在本申请中,第三方面所述的通信装置可以为第一设备(如手机、服务器等),或者设置于第一设备内部的芯片或芯片系统。In this application, the communication apparatus described in the third aspect may be a first device (such as a mobile phone, a server, etc.), or a chip or a chip system provided inside the first device.

第三方面所述的通信装置的技术效果可以参考第一方面中实现方式所述的通信方法的技术效果,此处不再赘述。For the technical effect of the communication apparatus described in the third aspect, reference may be made to the technical effect of the communication method described in the implementation manner of the first aspect, which will not be repeated here.

第四方面,提供一种处理器。其中,处理器用于执行第一方面中可能的实现方式所述的通信方法。In a fourth aspect, a processor is provided. Wherein, the processor is configured to execute the communication method described in the possible implementation manner of the first aspect.

第五方面,提供一种通信系统。该通信系统包括第一设备和第二设备。第一设备包括TCP层和中间层,中间层为TCP层的下层。In a fifth aspect, a communication system is provided. The communication system includes a first device and a second device. The first device includes a TCP layer and an intermediate layer, and the intermediate layer is a lower layer of the TCP layer.

第六方面,提供一种计算机可读存储介质。该计算机可读存储介质包括计算机程序或指令;当该计算机程序或指令在计算机上运行时,使得该计算机执行第一方面中可能的实现方式所述的通信方法。In a sixth aspect, a computer-readable storage medium is provided. The computer-readable storage medium includes a computer program or instruction; when the computer program or instruction is executed on a computer, the computer is made to execute the communication method described in the possible implementation manner of the first aspect.

第七方面,提供一种计算机程序产品,该计算机程序产品包括计算机程序或指令,当该计算机程序或指令在计算机上运行时,使得该计算机执行第一方面中可能的实现方式所述的通信方法。In a seventh aspect, a computer program product is provided, the computer program product includes a computer program or an instruction, when the computer program or instruction is run on a computer, the computer is made to execute the communication method described in the possible implementation manner of the first aspect .

附图说明Description of drawings

图1为本申请实施例提供的TCP/IP的架构示意图;1 is a schematic diagram of the architecture of TCP/IP provided by an embodiment of the present application;

图2为本申请实施例提供的TCP的连接建立过程和数据传输过程示意图;2 is a schematic diagram of a connection establishment process and a data transmission process of TCP provided by an embodiment of the present application;

图3为本申请实施例提供的拥塞窗口的示意图;3 is a schematic diagram of a congestion window provided by an embodiment of the present application;

图4为本申请实施例提供的一种通信系统的架构示意图一;FIG. 4 is a schematic diagram 1 of the architecture of a communication system provided by an embodiment of the present application;

图5为本申请实施例提供的一种通信系统的架构示意图二;FIG. 5 is a second schematic diagram of the architecture of a communication system according to an embodiment of the present application;

图6为本申请实施例提供的一种电子设备的结构示意图一;FIG. 6 is a schematic structural diagram 1 of an electronic device according to an embodiment of the present application;

图7为本申请实施例提供的一种电子设备中通信协议的架构示意图;7 is a schematic diagram of the architecture of a communication protocol in an electronic device provided by an embodiment of the present application;

图8为本申请实施例提供的通信方法的流程示意图一;FIG. 8 is a schematic flowchart 1 of a communication method provided by an embodiment of the present application;

图9为本申请实施例提供的通信方法的流程示意图二;FIG. 9 is a second schematic flowchart of a communication method provided by an embodiment of the present application;

图10为本申请实施例提供的通信方法的应用场景示意图;FIG. 10 is a schematic diagram of an application scenario of the communication method provided by the embodiment of the present application;

图11为本申请实施例提供的通信装置的结构示意图一;FIG. 11 is a schematic structural diagram 1 of a communication device provided by an embodiment of the present application;

图12为本申请实施例提供的通信装置的结构示意图二。FIG. 12 is a second schematic structural diagram of a communication apparatus provided by an embodiment of the present application.

具体实施方式Detailed ways

首先,为了便于理解,下面对本申请实施例可能涉及的相关术语和概念进行介绍。First, for ease of understanding, related terms and concepts that may be involved in the embodiments of the present application are introduced below.

1、TCP1. TCP

TCP为传输控制协议/网际协议(transmission control protocol/internetprotocol,TCP/IP)中的一种协议。具体地,以TCP/IP的四层参考模型为例,如图1所示,TCP/IP的四层参考模型从上到下依次包括:应用层、传输层、网络层和网络接口层。其中,TCP为传输层中的一种协议,也可以被称为TCP层。TCP is a protocol in transmission control protocol/internet protocol (TCP/IP). Specifically, taking the four-layer reference model of TCP/IP as an example, as shown in FIG. 1 , the four-layer reference model of TCP/IP includes, from top to bottom, an application layer, a transport layer, a network layer and a network interface layer. Among them, TCP is a protocol in the transport layer, which may also be called the TCP layer.

2、TCP报文2. TCP packets

TCP报文可由TCP层生成。例如,当手机向服务器发送数据时,手机中的各种应用程序(如微信、抖音等)可以生成待发送数据,并将这些待发送数据发送给应用层,由应用层对待发送数据处理后,再发送给TCP层。然后,TCP层可以对这些待发送的数据进一步封装,从而生成TCP报文。TCP packets can be generated by the TCP layer. For example, when the mobile phone sends data to the server, various applications in the mobile phone (such as WeChat, Douyin, etc.) can generate data to be sent, and send the data to be sent to the application layer, which will process the data to be sent by the application layer. , and then sent to the TCP layer. Then, the TCP layer can further encapsulate the data to be sent, thereby generating a TCP packet.

相应地,手机在接收到来自其他设备(如服务器)的TCP报文时,手机中的TCP层也可以对该TCP报文进行解析,得到TCP报文中携带的数据,并将解析后的数据通过应用层发送给对应的应用程序。Correspondingly, when the mobile phone receives a TCP packet from other devices (such as a server), the TCP layer in the mobile phone can also parse the TCP packet, obtain the data carried in the TCP packet, and parse the parsed data. It is sent to the corresponding application through the application layer.

TCP报文包括TCP头部(TCP header)和数据。其中,TCP头部包括的部分字段如下:序号(Seq)、确认号(Ack)、确认号控制位(ACK)、同步序号控制位(SYN)、窗口大小(winsize)、选项及填充。选项中包括窗口缩放因子(windows shrink option,WSOPT)。A TCP packet includes a TCP header (TCP header) and data. Among them, some fields included in the TCP header are as follows: sequence number (Seq), acknowledgment number (Ack), acknowledgment number control bit (ACK), synchronization sequence number control bit (SYN), window size (winsize), options and padding. Among the options are the window shrink option (WSOPT).

序号用于指示:TCP报文携带数据的第一个字节的序号。例如,TCP报文携带200字节的数据,假设这200字节的数据的序号依次为200-399(每个字节对应一个序号),则该TCP报文的序号为200,以此类推,下一个TCP报文的序号为400。The sequence number is used to indicate: the sequence number of the first byte of data carried by the TCP packet. For example, a TCP packet carries 200 bytes of data. Assuming that the sequence numbers of the 200 bytes of data are 200-399 (each byte corresponds to a sequence number), the sequence number of the TCP packet is 200, and so on. The sequence number of the next TCP packet is 400.

确认号用于指示:期望下一个接收到的TCP报文的序号。例如,服务端(server)已收到序号为200-399的数据,期望客户端发送的下一个TCP报文的序号为400,则服务端在向客户端反馈TCP报文时,可以设置TCP报文中的确认号为400。The acknowledgment number is used to indicate: the expected sequence number of the next received TCP packet. For example, the server (server) has received data with serial numbers 200-399, and expects the next TCP packet sent by the client to have a serial number of 400. When the server feeds back TCP packets to the client, it can set the TCP packet. The confirmation number in the text is 400.

确认号控制位用于指示:TCP报文中确认号是否有效。例如,确认号控制位为1时表示确认号有效,为0时表示确认号无效。其中,确认号控制位为1的TCP报文可以称为ACK报文或确认报文,确认报文表示服务端已收到客户端发送的上一个TCP报文,并指示客户端发送的下一个TCP报文中携带的数据的序号。The acknowledgment number control bit is used to indicate whether the acknowledgment number in the TCP message is valid. For example, when the confirmation number control bit is 1, it means the confirmation number is valid, and when it is 0, it means that the confirmation number is invalid. Among them, the TCP message whose acknowledgment number control bit is 1 can be called an ACK message or an acknowledgment message. The acknowledgment message indicates that the server has received the last TCP message sent by the client, and indicates the next TCP message sent by the client. The sequence number of the data carried in the TCP packet.

同步序号控制位应用于TCP的连接建立过程(也可称为TCP三次握手),同步序号控制位为1的TCP报文可以称为同步序列号(synchronous,SYN)报文,SYN报文通常应用于TCP三次握手中的前两次握手。The synchronization sequence number control bit is used in the connection establishment process of TCP (also known as the TCP three-way handshake). The first two handshakes in the TCP three-way handshake.

窗口大小和窗口缩放因子用于指示服务端的接收缓存的大小,以此控制客户端发送数据的速率,从而达到流量控制的目的。其中,假设窗口大小为N,窗口缩放因子为s,则服务端的接收缓存的大小=N*2^s。例如,若手机向服务器发送的TCP报文中,窗口大小=2048,窗口缩放因子=3,则手机的接收缓存的大小=2048*2^3=16384字节,进而服务器在向手机发送数据时,需要依据手机的接收缓存的大小确定向手机发送数据的速率。The window size and window scaling factor are used to indicate the size of the server's receive buffer, so as to control the rate at which the client sends data, so as to achieve the purpose of flow control. Among them, assuming that the window size is N and the window scaling factor is s, the size of the receiving buffer of the server = N*2^s. For example, if the TCP message sent by the mobile phone to the server, the window size = 2048, and the window scaling factor = 3, the size of the mobile phone's receiving buffer = 2048*2^3 = 16384 bytes, and then the server sends data to the mobile phone. , the rate of sending data to the mobile phone needs to be determined according to the size of the receiving buffer of the mobile phone.

需要说明的是,上述TCP头部中未被介绍到的字段可以参照现有技术规定,在此不再赘述。It should be noted that, for the fields not introduced in the above-mentioned TCP header, reference may be made to the provisions of the prior art, and details are not described herein again.

3、TCP连接建立过程和数据传输过程3. TCP connection establishment process and data transmission process

请参照图2,TCP的连接建立过程可以包括如下步骤1-步骤3:Please refer to Fig. 2, the connection establishment process of TCP may include the following steps 1-step 3:

步骤1,客户端向服务端发送第一握手报文,服务端接收来自客户端的第一握手报文。Step 1, the client sends a first handshake message to the server, and the server receives the first handshake message from the client.

其中,第一握手报文中的同步序号控制位=1,序号=ISN(c),ISN(c)中的c是指客户端,ISN(c)可以是随机生成的,也可以称为初始序列号(initial sequence number,ISN)。此外,第一握手报文中还可以携带窗口大小和窗口缩放因子,以确定客户端的接收缓存的大小。Among them, the synchronization sequence number control bit in the first handshake message=1, the sequence number=ISN(c), the c in the ISN(c) refers to the client, and the ISN(c) can be randomly generated, and can also be called the initial Serial number (initial sequence number, ISN). In addition, the first handshake message may also carry a window size and a window scaling factor to determine the size of the receiving buffer of the client.

步骤2,服务端向客户端发送第二握手报文,客户端接收来自服务端的第二握手报文。Step 2, the server sends a second handshake message to the client, and the client receives the second handshake message from the server.

其中,第二握手报文中的同步序号控制位=1,确认号控制位=1,确认号=ISN(c)+1,表示已收到第一握手报文,并且序号=ISN(s),ISN(s)中的s是指服务端,ISN(s)也可以是随机生成的。此外,第二握手报文中也可以携带窗口大小和窗口缩放因子,以指示服务端的接收缓存的大小。Among them, the synchronization sequence number control bit in the second handshake message=1, the confirmation number control bit=1, and the confirmation number=ISN(c)+1, indicating that the first handshake message has been received, and the sequence number=ISN(s) , the s in the ISN(s) refers to the server, and the ISN(s) can also be randomly generated. In addition, the second handshake message may also carry the window size and the window scaling factor to indicate the size of the receiving buffer of the server.

步骤3,客户端向服务端发送第三握手报文,服务端接收来自客户端的第三握手报文。Step 3, the client sends a third handshake message to the server, and the server receives the third handshake message from the client.

其中,第三握手报文中的确认号控制位=1,确认号=ISN(s)+1,表示已收到第二握手报文,序号=ISN(c)+1。Wherein, the confirmation number control bit in the third handshake message=1, and the confirmation number=ISN(s)+1, indicating that the second handshake message has been received, and the sequence number=ISN(c)+1.

完成上述TCP三次握手之后,客户端和服务端均处于连接建立(ESTABLISHED)状态,可以进行数据传输。其中,TCP协议是双工的,也即是说,客户端可以向服务端发送数据,服务端也可以向客户端发送数据,其中,发送数据的一方可以被称为数据发送方,接收数据的一方可以被称为数据接收方。另外,对于客户端来说,当客户端接收来自服务端的数据报文时,客户端接收的TCP报文可以被称为下行报文;当客户端向服务端发送数据报文时,客户端发送的TCP报文可以被称为上行报文。After completing the above-mentioned TCP three-way handshake, both the client and the server are in a connection establishment (ESTABLISHED) state, and data transmission can be performed. Among them, the TCP protocol is duplex, that is to say, the client can send data to the server, and the server can also send data to the client. A party may be referred to as the data recipient. In addition, for the client, when the client receives a data packet from the server, the TCP packet received by the client can be called a downlink packet; when the client sends a data packet to the server, the client sends TCP packets can be called upstream packets.

继续以客户端向服务端发送数据报文举例,请再参照图2,该数据传输过程可以包括如下步骤4、步骤5:Continuing to take the example of sending a data message from the client to the server, please refer to FIG. 2 again. The data transmission process may include the following steps 4 and 5:

步骤4,客户端向服务端发送数据报文,服务端接收来自客户端的数据报文。Step 4, the client sends a data packet to the server, and the server receives the data packet from the client.

步骤5,服务端向客户端发送确认报文,客户端接收来自服务端的确认报文。Step 5, the server sends a confirmation message to the client, and the client receives the confirmation message from the server.

示例性地,假设客户端向服务端发送的数据报文中携带100字节的数据,且数据报文中的序号=100,那么服务端在收到该数据报文时,可以向客户端发送确认报文,且该确认报文中的确认号控制位=1,确认号=200。该确认报文用于表示客户端已收到该数据报文,以指示客户端接下来发送的数据中,第一个数据的序号为200。换句话说,在数据传输过程中,服务端每接收到客户端的一个TCP报文,就需要向客户端反馈一个确认报文,以告知客户端已接收到数据和接下来需要传输的数据。Exemplarily, assuming that the data packet sent by the client to the server carries 100 bytes of data, and the sequence number in the data packet is 100, then when the server receives the data packet, it can send the data to the client. The confirmation message, and the confirmation number control bit in the confirmation message=1, and the confirmation number=200. The confirmation message is used to indicate that the client has received the data message, so as to indicate that the sequence number of the first data in the next data sent by the client is 200. In other words, during the data transmission process, every time the server receives a TCP packet from the client, it needs to feed back an acknowledgement packet to the client to inform the client that the data has been received and the data to be transmitted next.

4、TCP重传机制4. TCP retransmission mechanism

在上述步骤4、步骤5中,数据报文或确认报文均可能丢失,导致服务端不能正常接收到完整的数据。因此,为了实现传输的可靠性,在TCP中还存在重传机制,如超时重传机制和快速重传机制。In the above steps 4 and 5, the data message or the confirmation message may be lost, so that the server cannot receive the complete data normally. Therefore, in order to realize the reliability of transmission, there are retransmission mechanisms in TCP, such as timeout retransmission mechanism and fast retransmission mechanism.

以快速重传机制举例,数据报文丢失时,服务端会向客户端重复反馈携带相同确认号的确认报文,以指示重传丢失的数据。接收的携带相同确认号的确认报文达到重传阈值(如3个)时,客户端会向服务端重传该确认报文指示的数据。其中,上述携带相同确认号的确认报文也可以称为重传报文。Taking the fast retransmission mechanism as an example, when a data packet is lost, the server will repeatedly feed back an acknowledgment packet with the same acknowledgment number to the client to indicate retransmission of the lost data. When the received acknowledgment packets carrying the same acknowledgment number reach the retransmission threshold (for example, 3), the client will retransmit the data indicated by the acknowledgment packet to the server. The confirmation message carrying the same confirmation number may also be referred to as a retransmission message.

其中,同一段时间内,客户端可以向服务端连续发送多个数据报文,服务端每接收到一个数据报文便会反馈一个对应的确认报文。但是,若这连续的多个数据报文中出现报文丢失时,客户端会重复反馈确认报文,以指示重传丢失的报文。例如,假设客户端向服务端发送了4个数据报文,每个数据报文携带100字节的数据,序号分别为100、200、300、400。若序号200的数据报文丢失,则服务端会重复反馈序号为200的确认报文。Among them, within the same period of time, the client can continuously send multiple data packets to the server, and the server will feed back a corresponding confirmation packet every time it receives a data packet. However, if a packet loss occurs in these consecutive multiple data packets, the client will repeatedly feed back an acknowledgment packet to instruct to retransmit the lost packet. For example, suppose the client sends 4 data packets to the server, each data packet carries 100 bytes of data, and the serial numbers are 100, 200, 300, and 400 respectively. If the data packet with sequence number 200 is lost, the server will repeatedly feed back the confirmation packet with sequence number 200.

另外,上述快速重传机制中,服务端可以向客户端发送携带SACK(selectiveacknowledgment,选择确认)选项的确认报文,以指示哪些数据报文未被接收,哪些数据报文被接收。例如,假设客户端向服务端发送了10个数据报文,每个数据报文携带100字节的数据,序号分别为100、200、…、1000,且这10个数据报文中只有序号200、500、600的数据报文丢失,其他数据报文被服务端正确接收,那么服务端在反馈确认报文时,还会在反馈的确认报文中携带SACK选项。其中,该SACK选项用于指示:未接收到序号为200、500、600的数据报文,已接收到序号为100、300、400、700、800、900、1000的数据报文。这样,客户端收到携带该SACK选项的确认报文时,可以确定序号为200、500、600的数据报文可能丢失,从而可以一次性地重传这多个数据报文,而不是逐个重传,避免服务端因等待时间长而出现连接超时(timeout),提高客户端的重传效率。In addition, in the above fast retransmission mechanism, the server may send an acknowledgement packet carrying a SACK (selective acknowledgment, selective acknowledgment) option to the client to indicate which data packets have not been received and which data packets have been received. For example, suppose the client sends 10 data packets to the server, each data packet carries 100 bytes of data, the sequence numbers are 100, 200, ..., 1000, and only the sequence number 200 is among the 10 data packets. , 500, 600 data packets are lost, and other data packets are correctly received by the server, then when the server sends back an acknowledgment packet, it will also carry the SACK option in the feedback acknowledgment packet. The SACK option is used to indicate that data packets with sequence numbers 200, 500, and 600 have not been received, and data packets with sequence numbers of 100, 300, 400, 700, 800, 900, and 1000 have been received. In this way, when the client receives the acknowledgment packet carrying the SACK option, it can determine that the data packets with sequence numbers of 200, 500, and 600 may be lost, so that the multiple data packets can be retransmitted at one time instead of one by one. To avoid the connection timeout (timeout) on the server side due to long waiting time, and improve the retransmission efficiency of the client side.

本申请实施例中,报文丢失包括报文在有线链路或无线链路中丢失、出错等情况,本申请实施例对此不作限定。In this embodiment of the present application, the packet loss includes situations such as packet loss or error in a wired link or a wireless link, which is not limited in this embodiment of the present application.

5、滑动窗口和拥塞窗口5. Sliding windows and congestion windows

在TCP协议中,滑动窗口包括发送窗口和接收窗口,发送窗口由数据发送方维护,接收窗口由数据接收方维护。发送窗口是指待发送数据中可以发送的数据,接收窗口是指待接收数据中可以接收的数据。其中,接收窗口的长度与数据接收方的接收缓存的大小对应,比如,数据接收方的接收缓存的大小可以大于或等于数据接收方的接收窗口的长度。数据发送方还维护有拥塞窗口,发送窗口的长度=min(接收窗口的长度,拥塞窗口的长度),比如,数据接收方的接收窗口的长度为70字节,拥塞窗口的长度为50字节,则数据发送方的发送窗口的长度=min(70字节,50字节)=50字节。另外,在上行方向(即客户端向服务端发送数据),客户端维护的发送窗口也可以称为上行发送窗口,服务端维护的接收窗口也可以称为上行接收窗口。在下行方向(即客户端接收来自服务端的数据),客户端维护的接收窗口也可以称为下行接收窗口,服务端维护的发送窗口也可以称为下行发送窗口。In the TCP protocol, the sliding window includes a sending window and a receiving window, the sending window is maintained by the data sender, and the receiving window is maintained by the data receiver. The sending window refers to the data that can be sent in the data to be sent, and the receiving window refers to the data that can be received in the data to be received. The length of the receive window corresponds to the size of the receive buffer of the data receiver. For example, the size of the receive buffer of the data receiver may be greater than or equal to the length of the receive window of the data receiver. The data sender also maintains a congestion window, the length of the sending window = min (the length of the receiving window, the length of the congestion window), for example, the length of the receiving window of the data receiver is 70 bytes, and the length of the congestion window is 50 bytes. , then the length of the sending window of the data sender=min (70 bytes, 50 bytes)=50 bytes. In addition, in the upstream direction (that is, the client sends data to the server), the sending window maintained by the client may also be called an upstream sending window, and the receiving window maintained by the server may also be called an upstream receiving window. In the downstream direction (that is, the client receives data from the server), the receiving window maintained by the client may also be referred to as a downstream receiving window, and the sending window maintained by the server may also be referred to as a downstream sending window.

目前,如图3所示,在客户端与服务器建立连接后,进行数据交互的过程中,随着时间的变化,客户端的拥塞窗口的长度会逐渐增大到拥塞窗口峰值。但在此过程中,丢失报文时,客户端的TCP层会重传丢失报文,并大幅减小拥塞窗口的长度(如将拥塞窗口调整至最小值),从而导致客户端的发送窗口减小,进而降低客户端的发送速率。并且,只要重传丢失报文,客户端的TCP层就将拥塞窗口调整至最小值可能是不必要的。比如,在客户端与服务端之间的信道良好的情况下,丢失报文通常是由于噪声等偶然因素导致的,信道状态并未恶化,偶尔丢失报文时(如丢包率低于1%),客户端不需要减小拥塞窗口。又比如,在客户端与服务端之间的信道出现波动,但并未拥塞的情况下,丢失报文时,客户端不必将拥塞窗口调整至最小值。At present, as shown in FIG. 3 , after the client establishes a connection with the server, in the process of data interaction, with the change of time, the length of the congestion window of the client will gradually increase to the peak value of the congestion window. However, in this process, when a packet is lost, the TCP layer of the client will retransmit the lost packet and greatly reduce the length of the congestion window (for example, adjust the congestion window to the minimum value), resulting in a reduction of the client's sending window. This in turn reduces the client's sending rate. Also, it may not be necessary for the client's TCP layer to adjust the congestion window to a minimum value as long as lost packets are retransmitted. For example, when the channel between the client and the server is good, the lost packets are usually caused by accidental factors such as noise, and the channel status has not deteriorated. ), the client does not need to reduce the congestion window. For another example, when the channel between the client and the server fluctuates but is not congested, when packets are lost, the client does not need to adjust the congestion window to the minimum value.

下面将结合附图,对本申请中的技术方案进行描述。The technical solutions in the present application will be described below with reference to the accompanying drawings.

本申请实施例提供的一种通信方法可以应用于各种通信系统,例如有线通信系统或无线通信系统。其中,无线通信系统可以包括:无线保真(wireless fidelity,WiFi)系统,车到任意物体(vehicle to everything,V2X)通信系统、设备间(device-todevie,D2D)通信系统、车联网通信系统、第4代(4th generation,4G)移动通信系统,如长期演进(longterm evolution,LTE)系统、全球互联微波接入(worldwide interoperability formicrowave access,WiMAX)通信系统、第五代(5th generation,5G)移动通信系统,如新空口(new radio,NR)系统,以及未来的通信系统,如第六代(6th generation,6G)移动通信系统等。A communication method provided in this embodiment of the present application can be applied to various communication systems, for example, a wired communication system or a wireless communication system. Wherein, the wireless communication system may include: a wireless fidelity (wireless fidelity, WiFi) system, a vehicle-to-everything (V2X) communication system, a device-todevie (D2D) communication system, a vehicle networking communication system, 4th generation (4G) mobile communication systems, such as longterm evolution (LTE) systems, worldwide interoperability for microwave access (WiMAX) communication systems, 5th generation (5G) mobile communication systems Communication systems, such as a new radio (new radio, NR) system, and future communication systems, such as a sixth generation (6th generation, 6G) mobile communication system, etc.

请参照图4,为本申请实施例提供的一种通信系统的架构示意图一。本申请实施例提供的通信方法所应用的通信系统可以包括:第一设备和第二设备,第一设备包括TCP层和中间层,中间层为TCP层的下层。其中,第一设备与第二设备在基于TCP协议交互时,第一设备可以为客户端,第二设备为服务端,或者,第一设备可以为服务端,第二设备为客户端,本申请实施例对此不作限定。Please refer to FIG. 4 , which is a first schematic diagram of the architecture of a communication system according to an embodiment of the present application. The communication system to which the communication method provided in the embodiment of the present application is applied may include: a first device and a second device, where the first device includes a TCP layer and an intermediate layer, and the intermediate layer is a lower layer of the TCP layer. Wherein, when the first device and the second device interact based on the TCP protocol, the first device may be the client and the second device may be the server, or the first device may be the server and the second device may be the client. This application The embodiment does not limit this.

其中,第一设备和第二设备具体可以为:手机、服务器、电视(也可称为智慧屏、大屏设备等)、平板电脑(Pad)、个人计算机(personal computer,PC)、笔记本电脑、台式电脑、车载设备、可穿戴设备(如蓝牙耳机,智能手表等)、音响、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digitalassistant,PDA)、工业控制(industrial control)中的无线终端、无人驾驶(selfdriving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smartgrid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smartcity)中的无线终端、智慧家庭(smart home)中的无线终端、人工智能(artificialintelligence)设备等,本申请实施例对此不做任何限制。The first device and the second device may specifically be: a mobile phone, a server, a TV (also called a smart screen, a large-screen device, etc.), a tablet computer (Pad), a personal computer (PC), a notebook computer, Desktop computers, in-vehicle devices, wearable devices (such as Bluetooth headsets, smart watches, etc.), audio, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, ultra-mobile personal computers (ultra- mobile personal computer (UMPC), netbook, personal digital assistant (PDA), wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical Terminal, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, artificial intelligence (artificial intelligence) equipment etc., the embodiments of the present application do not impose any limitations on this.

示例性地,请参照图5,以通信系统中包括手机、电视、笔记本电脑以及服务器举例。第一设备和第二设备可以是手机、电视、笔记本电脑以及服务器中的任一个。Exemplarily, please refer to FIG. 5 , for example, the communication system includes a mobile phone, a TV, a notebook computer and a server. The first device and the second device may be any one of a mobile phone, a TV, a notebook computer and a server.

在本申请实施例中,第一设备与第二设备之间可以通过有线或者无线连接以实现数据交互。比如,图5所示的通信网络中包括网络设备1(例如,基站)和网络设备2(例如,路由器),若第一设备为手机,第二设备为服务器,则手机可以接入该网络的网络设备1,服务器可以接入该网络的网络设备2,从而进行交互。又比如,若第一设备为手机,第二设备为笔记本电脑,则手机和笔记本电脑可位于同一WiFi网络内,通过该WiFi网络进行交互。又例如,手机和笔记本电脑可以通过登录同一账号(例如华为账号),通过该账号对应的服务器进行交互。该服务器可以是上述图5所示的服务器,也可以是其他服务器。In this embodiment of the present application, a wired or wireless connection may be used between the first device and the second device to implement data interaction. For example, the communication network shown in FIG. 5 includes a network device 1 (eg, a base station) and a network device 2 (eg, a router). If the first device is a mobile phone and the second device is a server, the mobile phone can access the network The network device 1 and the server can access the network device 2 of the network to interact with each other. For another example, if the first device is a mobile phone and the second device is a notebook computer, the mobile phone and the notebook computer may be located in the same WiFi network, and interact through the WiFi network. For another example, a mobile phone and a laptop computer can log in to the same account (for example, a Huawei account) and interact through a server corresponding to the account. The server may be the server shown in FIG. 5 above, or may be other servers.

在本申请实施例中,请参照图5,以第一设备为手机,第二设备为服务器进行举例。手机中设置有TCP层和中间层,中间层为TCP层的下层。中间层可以接收来自服务器的TCP报文,然后向TCP层发送该TCP报文。其中,中间层在接收到来自服务器的第一报文,且该第一报文用于指示TCP层重传第一数据时,向服务器发送第一数据,并丢弃(也可以为过滤、删除)该第一报文。这样,中间层不仅可以完成丢失数据的重传,还可以过滤发送给TCP层的重传报文,从而避免手机的TCP层因接收到重传报文而降低报文的发送速率。In the embodiment of the present application, referring to FIG. 5 , the first device is a mobile phone and the second device is a server as an example. The mobile phone is provided with a TCP layer and an intermediate layer, and the intermediate layer is the lower layer of the TCP layer. The middle layer can receive TCP packets from the server, and then send the TCP packets to the TCP layer. Wherein, when the middle layer receives the first packet from the server, and the first packet is used to instruct the TCP layer to retransmit the first data, it sends the first data to the server and discards it (it may also be filtering or deleting) the first message. In this way, the middle layer can not only complete the retransmission of lost data, but also filter the retransmitted packets sent to the TCP layer, thereby preventing the TCP layer of the mobile phone from reducing the packet sending rate due to receiving the retransmitted packets.

以上结合图4、图5说明了本申请实施例所提供的通信系统,下面将结合附图对本申请实施例的实施方式进行详细描述。The communication system provided by the embodiments of the present application has been described above with reference to FIG. 4 and FIG. 5 , and the implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

示例性地,仍以手机作为上述通信系统中的第一设备举例,请参照图6,图6示出了手机600的结构示意图。Illustratively, still taking a mobile phone as the first device in the above communication system as an example, please refer to FIG. 6 , which shows a schematic structural diagram of a mobile phone 600 .

手机600可以包括处理器610,外部存储器接口620,内部存储器621,通用串行总线(universal serial bus,USB)接口630,天线1,天线2,移动通信模块650,无线通信模块660,音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接口670D,传感器模块680等。The mobile phone 600 may include a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, an antenna 1, an antenna 2, a mobile communication module 650, a wireless communication module 660, and an audio module 670 , speaker 670A, receiver 670B, microphone 670C, headphone jack 670D, sensor module 680, etc.

可以理解的是,本发明实施例示意的结构并不构成对手机600的具体限定。在本申请另一些实施例中,手机600可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the mobile phone 600 . In other embodiments of the present application, the mobile phone 600 may include more or less components than shown, or some components are combined, or some components are separated, or different components are arranged. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

处理器610可以包括一个或多个处理单元,例如:处理器610可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 610 may include one or more processing units, for example, the processor 610 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and/or neural-network processing unit (NPU), etc. . Wherein, different processing units may be independent devices, or may be integrated in one or more processors.

处理器610中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器610中的存储器为高速缓冲存储器。该存储器可以保存处理器610刚用过或循环使用的指令或数据。如果处理器610需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器610的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 610 for storing instructions and data. In some embodiments, the memory in processor 610 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 610 . If the processor 610 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the waiting time of the processor 610 is reduced, thereby increasing the efficiency of the system.

手机600的无线通信功能可以通过天线1,天线2,移动通信模块650,无线通信模块660,调制解调处理器以及基带处理器等实现。The wireless communication function of the mobile phone 600 can be implemented by the antenna 1, the antenna 2, the mobile communication module 650, the wireless communication module 660, the modulation and demodulation processor, the baseband processor, and the like.

天线1和天线2用于发射和接收电磁波信号。手机600中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in handset 600 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.

移动通信模块650可以提供应用在手机600上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块650可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(lownoise amplifier,LNA)等。移动通信模块650可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块650还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块650的至少部分功能模块可以被设置于处理器610中。在一些实施例中,移动通信模块650的至少部分功能模块可以与处理器610的至少部分模块被设置在同一个器件中。The mobile communication module 650 can provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the mobile phone 600 . The mobile communication module 650 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. The mobile communication module 650 can receive electromagnetic waves from the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 650 can also amplify the signal modulated by the modulation and demodulation processor, and then convert it into electromagnetic waves for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 650 may be provided in the processor 610 . In some embodiments, at least part of the functional modules of the mobile communication module 650 may be provided in the same device as at least part of the modules of the processor 610 .

无线通信模块660可以提供应用在手机600上的包括无线局域网(wireless localarea networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequencymodulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块660可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块660经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器610。无线通信模块660还可以从处理器610接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 660 can provide applications on the mobile phone 600 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite systems ( global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 660 may be one or more devices integrating at least one communication processing module. The wireless communication module 660 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 610 . The wireless communication module 660 can also receive the signal to be sent from the processor 610 , perform frequency modulation on the signal, amplify the signal, and then convert it into an electromagnetic wave for radiation through the antenna 2 .

在一些实施例中,手机600的天线1和移动通信模块650耦合,天线2和无线通信模块660耦合,使得手机600可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code divisionmultiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(globalnavigation satellite system,GLONASS),北斗卫星导航系统(beidou navigationsatellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the mobile phone 600 is coupled with the mobile communication module 650, and the antenna 2 is coupled with the wireless communication module 660, so that the mobile phone 600 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code Division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (quasi-zenith). satellite system, QZSS) and/or satellite based augmentation systems (SBAS).

手机600通过GPU,显示屏694,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏694和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器610可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The mobile phone 600 implements a display function through a GPU, a display screen 694, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 694 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 610 may include one or more GPUs that execute program instructions to generate or alter display information.

显示屏694用于显示图像,视频等。显示屏694包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,手机600可以包括1个或N个显示屏694,N为大于1的正整数。Display screen 694 is used to display images, videos, and the like. Display screen 694 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). , AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (quantum dot light emitting diodes, QLED) and so on. In some embodiments, cell phone 600 may include 1 or N display screens 694, where N is a positive integer greater than 1.

手机600可以通过ISP,摄像头693,视频编解码器,GPU,显示屏694以及应用处理器等实现拍摄功能。The mobile phone 600 can realize the shooting function through the ISP, the camera 693, the video codec, the GPU, the display screen 694 and the application processor.

ISP用于处理摄像头693反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头693中。The ISP is used to process the data fed back by the camera 693 . For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 693 .

摄像头693用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,手机600可以包括1个或N个摄像头693,N为大于1的正整数。Camera 693 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the cell phone 600 may include 1 or N cameras 693 , where N is a positive integer greater than 1.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当手机600在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the mobile phone 600 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point, and so on.

视频编解码器用于对数字视频压缩或解压缩。手机600可以支持一种或多种视频编解码器。这样,手机600可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. Cell phone 600 may support one or more video codecs. In this way, the mobile phone 600 can play or record videos in various encoding formats, such as: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.

外部存储器接口620可以用于连接外部存储卡,例如Micro SD卡,实现扩展手机600的存储能力。外部存储卡通过外部存储器接口620与处理器610通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 620 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 600 . The external memory card communicates with the processor 610 through the external memory interface 620 to realize the data storage function. For example to save files like music, video etc in external memory card.

内部存储器621可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器610通过运行存储在内部存储器621的指令,从而执行手机600的各种功能应用以及数据处理。内部存储器621可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能、图像播放功能、TCP加速功能等)等。存储数据区可存储手机600使用过程中所创建的数据(比如音频数据、电话本、TCP报文等)等。此外,内部存储器621可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。Internal memory 621 may be used to store computer executable program code, which includes instructions. The processor 610 executes various functional applications and data processing of the mobile phone 600 by executing the instructions stored in the internal memory 621 . The internal memory 621 may include a storage program area and a storage data area. The storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, a TCP acceleration function, etc.), and the like. The storage data area can store data (such as audio data, phone book, TCP messages, etc.) created during the use of the mobile phone 600, and the like. In addition, the internal memory 621 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.

手机600可以通过音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接口670D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The mobile phone 600 can implement audio functions through an audio module 670, a speaker 670A, a receiver 670B, a microphone 670C, an earphone interface 670D, and an application processor. Such as music playback, recording, etc.

音频模块670用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块670还可以用于对音频信号编码和解码。在一些实施例中,音频模块670可以设置于处理器610中,或将音频模块670的部分功能模块设置于处理器610中。The audio module 670 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 670 may also be used to encode and decode audio signals. In some embodiments, the audio module 670 may be provided in the processor 610 , or some functional modules of the audio module 670 may be provided in the processor 610 .

扬声器670A,也称“喇叭”,用于将音频电信号转换为声音信号。手机600可以通过扬声器670A收听音乐,或收听免提通话。Speaker 670A, also referred to as "horn", is used to convert audio electrical signals into sound signals. Mobile phone 600 can listen to music through speaker 670A, or listen to hands-free calls.

受话器670B,也称“听筒”,用于将音频电信号转换成声音信号。当手机600接听电话或语音信息时,可以通过将受话器670B靠近人耳接听语音。The receiver 670B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the mobile phone 600 answers a call or a voice message, the voice can be answered by placing the receiver 670B close to the human ear.

麦克风670C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风670C发声,将声音信号输入到麦克风670C。手机600可以设置至少一个麦克风670C。在另一些实施例中,手机600可以设置两个麦克风670C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,手机600还可以设置三个,四个或更多麦克风670C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。Microphone 670C, also called "microphone", "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 670C through the human mouth, and input the sound signal into the microphone 670C. The mobile phone 600 may be provided with at least one microphone 670C. In other embodiments, the mobile phone 600 may be provided with two microphones 670C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the mobile phone 600 may be further provided with three, four or more microphones 670C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.

耳机接口670D用于连接有线耳机。耳机接口670D可以是USB接口630,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The headphone jack 670D is used to connect wired headphones. The earphone interface 670D may be a USB interface 630, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.

传感器模块680中可以包括压力传感器,陀螺仪传感器,气压传感器,磁传感器,加速度传感器,距离传感器,接近光传感器,指纹传感器,温度传感器,触摸传感器,环境光传感器,骨传导传感器等。The sensor module 680 may include a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

当然,手机600还可以包括充电管理模块、电源管理模块、电池、按键、指示器以及1个或多个SIM卡接口等,本申请实施例对此不做任何限制。Of course, the mobile phone 600 may also include a charging management module, a power management module, a battery, a button, an indicator, and one or more SIM card interfaces, etc., which are not limited in this embodiment of the present application.

上述图6以手机600为例说明了通信系统中第一设备的结构,下面继续以手机600为例说明第一设备可以采用的通信协议架构。The above FIG. 6 uses the mobile phone 600 as an example to illustrate the structure of the first device in the communication system. Next, the mobile phone 600 is used as an example to describe the communication protocol architecture that can be adopted by the first device.

手机600中可以包括:应用层、传输层、网络层、网络接口层以及中间层。The mobile phone 600 may include: an application layer, a transport layer, a network layer, a network interface layer, and an intermediate layer.

其中,应用层中可以包括文件传输协议(file transfer protocol,FTP)、简单邮件传输协议(simple mail transfer protocol,SMTP)等协议,传输层中可以包括TCP、用户数据包协议(user datagram protocol,UDP)等协议,网络层中可以包括网际互连协议(internet protocol,IP)、控制报文协议(internet control message protocol,ICMP)等协议,网络接口层中通常包括数据链路层和物理层,在数据链路层中还包括媒体接入控制(media access control,MAC)层。在实际应用中,网络接口层可以采用如下一项或多项协议实现:近场通信(near field communication,NFC)、射频识别(radio frequencyidentification,RFID)、蓝牙(bluetooth)、2G、3G、4G、5G、Wi-Fi、紫蜂协议(ZigBee)、远距离无线电(long range radio,LORA)、USB、RS485等。中间层为本申请实施例引入的一个独立的协议层,可以位于MAC层与TCP层之间。The application layer may include protocols such as file transfer protocol (FTP), simple mail transfer protocol (SMTP), and the transport layer may include TCP, user datagram protocol (UDP) and other protocols. ) and other protocols, the network layer may include protocols such as the Internet Protocol (IP) and the Internet Control Message Protocol (ICMP), and the network interface layer usually includes the data link layer and the physical layer. The data link layer further includes a media access control (media access control, MAC) layer. In practical applications, the network interface layer can be implemented by one or more of the following protocols: near field communication (NFC), radio frequency identification (RFID), bluetooth, 2G, 3G, 4G, 5G, Wi-Fi, ZigBee, long range radio (LORA), USB, RS485, etc. The intermediate layer is an independent protocol layer introduced in this embodiment of the present application, and may be located between the MAC layer and the TCP layer.

示例性地,如图7中的(a)所示,中间层可以位于网络接口层且为MAC层的上层。或者如图7中的(b)所示,中间层可以位于网络层。又如图7中的(c)所示,中间层可以位于传输层且为TCP层的下层。再如图7中的(d)所示,中间层可以位于网络层与网络接口层之间。再例如图7中的(e)所示,中间层可以位于传输层与网络层之间。Exemplarily, as shown in (a) of FIG. 7 , the middle layer may be located at the network interface layer and be an upper layer of the MAC layer. Alternatively, as shown in (b) of FIG. 7 , the intermediate layer may be located at the network layer. As also shown in (c) of FIG. 7 , the intermediate layer may be located at the transport layer and be a lower layer of the TCP layer. As shown in (d) of FIG. 7 , the middle layer may be located between the network layer and the network interface layer. For another example, as shown in (e) of FIG. 7 , the intermediate layer may be located between the transport layer and the network layer.

在本申请实施例中,中间层可以向上层转发来自下层的报文(即下行报文),也可以向下层转发来自上层的报文(即上行报文)。其中,中间层还包括缓冲区,中间层在转发下行报文或上行报文时,还可以在缓冲区中存储与下行报文或上行报文相同的报文。In the embodiment of the present application, the middle layer may forward the packet from the lower layer (ie, the downlink packet) to the upper layer, and may also forward the packet from the upper layer (ie, the uplink packet) to the lower layer. Wherein, the intermediate layer further includes a buffer, and when forwarding the downlink packet or the uplink packet, the intermediate layer may also store the same packet as the downlink packet or the uplink packet in the buffer.

在本申请实施例中,中间层接收到报文(包括上行报文和下行报文)时,还可以解析该报文,以分析报文中携带的TCP报文。结合上述图7可知,当中间层位于TCP层与网络层中的IP层之间时,中间层接收到的报文为TCP报文,中间层可以分析该TCP报文;当中间层为IP层的下层时,中间层接收到的报文为IP报文,中间层需要先解析IP报文的头部,从IP报文中提取TCP报文,再分析该TCP报文。换句话说,中间层位于TCP层与IP层之间,能够减少中间层解析报文的开销,从而提高处理效率。In this embodiment of the present application, when receiving a packet (including an uplink packet and a downlink packet), the intermediate layer may also parse the packet to analyze the TCP packet carried in the packet. 7, when the middle layer is located between the TCP layer and the IP layer in the network layer, the message received by the middle layer is a TCP message, and the middle layer can analyze the TCP message; when the middle layer is the IP layer When the lower layer is used, the packet received by the middle layer is an IP packet, and the middle layer needs to parse the header of the IP packet first, extract the TCP packet from the IP packet, and then analyze the TCP packet. In other words, the intermediate layer is located between the TCP layer and the IP layer, which can reduce the overhead of parsing packets by the intermediate layer, thereby improving processing efficiency.

其中,中间层以下的其他协议层可以被称为其他层。例如,当中间层位于网络接口层时,其他层包括MAC层和物理层。又例如,当中间层位于传输层与网络层之间时,其他层包括网络层(如IP层)、MAC层和物理层。Among them, other protocol layers below the middle layer may be referred to as other layers. For example, while the middle layer is at the network interface layer, the other layers include the MAC layer and the physical layer. For another example, when the middle layer is located between the transport layer and the network layer, the other layers include the network layer (eg, the IP layer), the MAC layer, and the physical layer.

上述图7以手机600为例说明了第一设备可以采用的通信协议架构,以下将结合附图详细阐述本申请实施例提供的一种通信方法。The above-mentioned FIG. 7 uses the mobile phone 600 as an example to illustrate the communication protocol architecture that the first device can adopt. The following will describe in detail a communication method provided by the embodiments of the present application with reference to the accompanying drawings.

本申请实施例提供的通信方法可以应用于图4所示通信系统中的第一设备,以第一设备为手机,第二设备为服务器,且手机为客户端,服务器为服务端为例,请参照图8,上述通信方法可以包括如下步骤:The communication method provided by the embodiment of the present application can be applied to the first device in the communication system shown in FIG. 4 . Taking the first device as a mobile phone, the second device as a server, the mobile phone as a client and the server as an example, please 8, the above communication method may include the following steps:

S801,TCP层向中间层发送第一数据报文,中间层接收来自TCP层的第一数据报文。S801, the TCP layer sends a first data packet to the intermediate layer, and the intermediate layer receives the first data packet from the TCP layer.

其中,第一数据报文携带第一数据。例如,第一数据报文可以来自手机的应用层,携带有手机中的各种应用程序(如微信、抖音等)生成的数据。The first data packet carries the first data. For example, the first data packet may come from the application layer of the mobile phone, and carry data generated by various application programs (such as WeChat, Douyin, etc.) in the mobile phone.

应理解,中间层缓存来自TCP层的第一数据报文,以便重传。具体实施方式可以参考下述S805中的相关说明,在此不再赘述。It should be understood that the intermediate layer buffers the first data packet from the TCP layer for retransmission. For a specific implementation manner, reference may be made to the relevant description in the following S805, which will not be repeated here.

如图7中的(c)所示,以中间层位于传输层且为TCP层的下层为例,上述TCP层向中间层发送第一数据报文,可以包括如下实施方式:TCP层向中间层发送第一数据报文。接收到第一数据报文时,中间层复制该第一数据报文,并将复制的报文存入缓冲区。As shown in (c) in FIG. 7 , taking the middle layer located at the transport layer and being the lower layer of the TCP layer as an example, the above-mentioned TCP layer sending the first data packet to the middle layer may include the following implementation manner: the TCP layer sends the middle layer to the middle layer. Send the first data message. When receiving the first data message, the intermediate layer copies the first data message, and stores the copied message in the buffer.

另外,手机中的TCP层、中间层和其他层可以参照上文说明,在此不再赘述。In addition, for the TCP layer, the middle layer and other layers in the mobile phone, reference may be made to the above description, which will not be repeated here.

S802,中间层向其他层发送第一数据报文,其他层接收来自中间层的第一数据报文。S802, the intermediate layer sends the first data packet to other layers, and the other layers receive the first data packet from the intermediate layer.

如图7中的(c)所示,继续以中间层位于传输层且为TCP层的下层为例,中间层向其他层发送第一数据报文,可以包括如下实施方式:中间层向其他层中的网络层发送第一数据报文。接收到该第一数据报文时,网络层对该第一数据报文进行处理,如网络层中的IP层将该第一数据报文封装为IP报文。As shown in (c) in FIG. 7 , continuing to take the example that the middle layer is located at the transport layer and is the lower layer of the TCP layer, the middle layer sends the first data packet to other layers, which may include the following implementation manner: the middle layer sends the first data packet to other layers. The network layer in sends the first data packet. When receiving the first data packet, the network layer processes the first data packet, for example, the IP layer in the network layer encapsulates the first data packet into an IP packet.

S803,其他层向服务器发送第一数据报文,服务器接收来自其他层的第一数据报文。S803, the other layers send the first data packet to the server, and the server receives the first data packet from the other layers.

如图7中的(c)所示,继续以中间层位于传输层且为TCP层的下层为例,其他层向服务器发送第一数据报文,可以包括如下实施方式:其他层中的网络层向MAC层发送携带第一数据报文的报文(如上述的IP报文)。MAC层将来自网络层的报文封装为数据帧(携带第一数据报文),并通过物理层将这些数据帧向服务器发送。As shown in (c) in FIG. 7 , continuing to take the example that the intermediate layer is located in the transport layer and is the lower layer of the TCP layer, the other layers send the first data packet to the server, which may include the following embodiments: the network layer in the other layers A packet (such as the above IP packet) carrying the first data packet is sent to the MAC layer. The MAC layer encapsulates the packets from the network layer into data frames (carrying the first data packet), and sends these data frames to the server through the physical layer.

由于网络的有线链路或无线链路并不稳定,第一数据报文在网络传输的过程中可能会丢失,因此,服务器可能接收到该第一数据报文,也可能接收不到该第一数据报文。其中,报文丢失包括:报文在有线链路或无线链路中丢失、误码等,比如,当报文存在误码时,服务器即使接收到该报文,也不能正确解析该报文携带的数据,从而会确认该报文丢失。Since the wired link or wireless link of the network is not stable, the first data packet may be lost during network transmission. Therefore, the server may or may not receive the first data packet. data message. Among them, the packet loss includes: the packet is lost in the wired link or wireless link, bit error, etc. For example, when the packet has bit error, even if the server receives the packet, it cannot correctly parse the packet carried by the packet. data, thus confirming that the message is lost.

服务器确定第一数据报文是否丢失的方式,可以包括:以接收到第一数据报文的上一个报文的时间为起点,当服务器在超过接收时间阈值未收到来自手机的第一数据报文时,服务器确定第一数据报文丢失。The way in which the server determines whether the first data packet is lost may include: starting from the time when the last packet of the first data packet is received, when the server does not receive the first data packet from the mobile phone when the receiving time threshold exceeds the threshold When the message is sent, the server determines that the first data message is lost.

在本申请实施例中,第一数据报文未丢失时,服务器可以执行上文中的步骤5,通过向手机反馈确认报文,从而通知手机已收到第一数据报文。在第一数据报文丢失时,图8所示的通信方法可以包括如下几个步骤:In this embodiment of the present application, when the first data packet is not lost, the server may perform step 5 above to notify the mobile phone that the first data packet has been received by feeding back a confirmation packet to the mobile phone. When the first data packet is lost, the communication method shown in FIG. 8 may include the following steps:

S804,服务器向其他层发送第一确认报文,其他层接收来自服务器的第一确认报文。S804, the server sends the first confirmation message to other layers, and the other layers receive the first confirmation message from the server.

其中,第一确认报文用于指示TCP层重传第一数据。换句话说,第一确认报文为重传报文。The first confirmation message is used to instruct the TCP layer to retransmit the first data. In other words, the first acknowledgment message is a retransmission message.

参照上文的TCP的重传机制,服务器在确定第一数据报文丢失时,可以向手机重复反馈携带相同确认号的确认报文。例如,假设第一数据报文的序号为=100,则服务器可以向手机重复反馈确认号=100的第一确认报文。也即是说,其他层和中间层可以重复接收到来自服务器的第一确认报文。另外,服务器向手机重复反馈携带相同确认号的确认报文时,还可以在该确认报文中携带SACK选项,以指示哪些数据报文未被接收,哪些数据报文被接收。例如,假设手机连续向服务器发送了5个数据报文,每个数据报文携带100字节的数据,序号分别为100、200、300、400、500,且序号为100、300、400的数据报文丢失,序号为200、500的数据报文被服务器接收,那么服务器可以向手机重复反馈携带SACK选项的第一确认报文。其中,该SACK选项用于指示:未接收到序号为100、300、400的数据报文,已接收到序号为200、500的数据报文。这样,手机收到携带该SACK选项的确认报文时,可以确定序号为100、300、400的数据报文可能丢失,从而可以一次性地重传这多个数据报文,而不是逐个重传,避免服务端因等待时间长而出现连接超时,提高客户端的重传效率。Referring to the retransmission mechanism of TCP above, when the server determines that the first data packet is lost, the server may repeatedly feed back an acknowledgement packet carrying the same acknowledgement number to the mobile phone. For example, assuming that the sequence number of the first data message is = 100, the server may repeatedly feed back the first confirmation message with confirmation number = 100 to the mobile phone. That is to say, other layers and the middle layer can repeatedly receive the first confirmation message from the server. In addition, when the server repeatedly feeds back the confirmation message carrying the same confirmation number to the mobile phone, the confirmation message may also carry the SACK option to indicate which data packets are not received and which data packets are received. For example, suppose that the mobile phone continuously sends 5 data packets to the server, each data packet carries 100 bytes of data, the serial numbers are 100, 200, 300, 400, 500, and the serial numbers are 100, 300, 400 data If the packet is lost, and the data packets with serial numbers 200 and 500 are received by the server, the server can repeatedly feed back the first confirmation packet carrying the SACK option to the mobile phone. The SACK option is used to indicate that data packets with sequence numbers 100, 300, and 400 have not been received, and data packets with sequence numbers of 200 and 500 have been received. In this way, when the mobile phone receives the acknowledgment packet carrying the SACK option, it can determine that the data packets with serial numbers 100, 300, and 400 may be lost, so that the multiple data packets can be retransmitted at one time instead of one by one. , to avoid connection timeout on the server due to long waiting time, and improve the retransmission efficiency of the client.

S805,其他层向中间层发送第一确认报文,中间层接收来自其他层的第一确认报文。S805, the other layers send the first confirmation message to the middle layer, and the middle layer receives the first confirmation message from the other layers.

与上述S802、S803类似,上述其他层接收来自服务器的第一确认报文,并向中间层发送第一确认报文,可以包括如下实施方式:其他层中的物理层接收来自服务器的携带第一确认报文的数据,并对这些数据进行解析,以及向MAC层发送解析后的数据。接收到来自物理层的数据时,MAC层用于解析出这些数据中的报文(携带第一确认报文),以及通过网络层向中间层发送第一确认报文的。Similar to the above S802 and S803, the above-mentioned other layers receive the first confirmation message from the server and send the first confirmation message to the intermediate layer, which may include the following embodiments: the physical layer in the other layers receives the first confirmation message from the server and carries the first confirmation message. Confirm the data of the message, parse the data, and send the parsed data to the MAC layer. When receiving data from the physical layer, the MAC layer is used to parse out the packets in the data (carrying the first confirmation packet), and send the first confirmation packet to the intermediate layer through the network layer.

在实际传输数据时,其他层不仅会向中间层发送第一确认报文,还会向中间层发送其他报文。为了确定第一确认报文,中间层可以确定所有来自服务器的报文中确认号相同的多个确认报文,以及确定该多个确认报文中的第n个确认报文为第一报文,n可以为大于或等于2的整数。具体可以参照如下第一判断过程。During actual data transmission, other layers will not only send the first acknowledgment message to the middle layer, but also send other messages to the middle layer. In order to determine the first acknowledgment message, the intermediate layer may determine a plurality of acknowledgment messages with the same acknowledgment number in all messages from the server, and determine that the nth acknowledgment message in the plurality of acknowledgment messages is the first message , n can be an integer greater than or equal to 2. For details, refer to the following first judgment process.

第一判断过程可以包括:中间层解析每个来自其他层的数据中的TCP报文,当在解析出的TCP报文中存在多个确认号相同的确认报文时,确定这多个相同的确认报文中,第n个确认报文为上述第一确认报文。换句话说,接收到来自服务器的重传报文达到第一阈值时,中间层将这些重传报文确定为第一确认报文。其中,第一阈值为大于或等于2的整数,可选地,第一阈值的大小与TCP重传机制中的重传阈值的大小相同。The first judgment process may include: the middle layer parses each TCP message in the data from other layers, and when there are multiple acknowledgment messages with the same acknowledgment number in the parsed TCP message, determine the multiple identical acknowledgment messages. Among the confirmation messages, the nth confirmation message is the above-mentioned first confirmation message. In other words, when the retransmitted packets received from the server reach the first threshold, the intermediate layer determines these retransmitted packets as the first acknowledgment packets. The first threshold is an integer greater than or equal to 2. Optionally, the size of the first threshold is the same as the size of the retransmission threshold in the TCP retransmission mechanism.

示例性地,请参照下表1,表1示出的是中间层在解析每个来自其他层的数据中的TCP报文时,解析出的5个TCP报文。其中,TCP报文1-TCP报文5按接收时间先后顺序被解析出来,TCP报文1被解析的时间最早,TCP报文5被解析的时间最晚,且TCP报文1-TCP报文5均为确认报文。TCP报文1的确认号=100,TCP报文2的确认号=200,TCP报文3的确认号=300,TCP报文4的确认号=300,TCP报文5的确认号=300。换句话说,解析出的TCP报文中存在3个确认号相同的确认报文,分别为TCP报文3、TCP报文4、TCP报文5,从而这5个TCP报文中,TCP报文4、TCP报文5均为上述第一确认报文。Exemplarily, please refer to Table 1 below. Table 1 shows five TCP packets parsed by the middle layer when parsing each TCP packet in data from other layers. Among them, TCP packet 1-TCP packet 5 is parsed in the order of receiving time, TCP packet 1 is parsed the earliest time, TCP packet 5 is parsed the latest time, and TCP packet 1-TCP packet 5 are confirmation messages. The acknowledgment number of TCP message 1=100, the acknowledgment number of TCP message 2=200, the acknowledgment number of TCP message 3=300, the acknowledgment number of TCP message 4=300, and the acknowledgment number of TCP message 5=300. In other words, there are 3 acknowledgment packets with the same acknowledgment number in the parsed TCP packets, namely TCP packet 3, TCP packet 4, and TCP packet 5. Therefore, among these 5 TCP packets, TCP packet Message 4 and TCP message 5 are both the above-mentioned first confirmation messages.

表1Table 1

确认号Confirmation Number 确认号控制位acknowledgment number control bit TCP报文1TCP message 1 100100 11 TCP报文2TCP message 2 200200 11 TCP报文3TCP message 3 300300 11 TCP报文4TCP message 4 300300 11 TCP报文5TCP message 5 300300 11

由于中间层可以重复接收到来自服务器的确认报文,从而可选地,当在解析出的TCP报文中存在2个确认号相同的确认报文时,中间层将这2个确认号相同的确认报文中的第2个确认报文确定为上述第一确认报文。也即是说上述n=2。Since the middle layer can repeatedly receive acknowledgment packets from the server, optionally, when there are two acknowledgment packets with the same acknowledgment number in the parsed TCP packet, the middle layer will store the two acknowledgment packets with the same acknowledgment number. The second confirmation message in the confirmation message is determined to be the above-mentioned first confirmation message. That is, the above-mentioned n=2.

继续以上表1为例,当中间层解析出TCP报文4时,由于TCP报文4与TCP报文3相同,且为TCP报文4、TCP报文3中的第2个确认报文,从而TCP报文4为上述第一确认报文。与接收到超过重传阈值个重传报文才重传丢失报文相比,本申请实施例中,在第一次接收到重传报文时,中间层可以立即在缓存中找到丢失报文,并进行重传,从而可以更快地将丢失报文重传,提升TCP的数据传输效率。Taking Table 1 above as an example, when the middle layer parses out TCP packet 4, since TCP packet 4 is the same as TCP packet 3, and is the second acknowledgment packet in TCP packet 4 and TCP packet 3, Therefore, the TCP packet 4 is the above-mentioned first confirmation packet. Compared with retransmitting the lost packet after receiving the retransmission packets exceeding the retransmission threshold, in this embodiment of the present application, when the retransmission packet is received for the first time, the intermediate layer can immediately find the lost packet in the cache. , and retransmit, so that the lost packets can be retransmitted faster, and the data transmission efficiency of TCP can be improved.

一种可能的实施例中,中间层可以接收来自服务器的第四报文。例如,在解析每个来自其他层的数据中的TCP报文时,中间层将解析出的确认报文确定为第四报文。然后,中间层可以判断已接收的所有确认报文中是否存在第五报文,该第五报文的确认号与第四报文的确认号相同。若中间层已接收的所有确认报文中不存在第五报文,则中间层可以向TCP层发送第四报文;若中间层已接收的所有确认报文中存在第五报文,则中间层可以不向TCP层发送第四报文。这样,TCP层可以根据第四报文中的确认号向服务器发送下一个数据报文。In a possible embodiment, the middle layer may receive the fourth packet from the server. For example, when parsing each TCP packet in data from other layers, the middle layer determines the parsed confirmation packet as the fourth packet. Then, the intermediate layer can determine whether there is a fifth message in all the received confirmation messages, and the confirmation number of the fifth message is the same as that of the fourth message. If the fifth packet does not exist in all the confirmation packets received by the intermediate layer, the intermediate layer can send the fourth packet to the TCP layer; if there is a fifth packet in all the confirmation packets received by the intermediate layer, the intermediate layer The layer may not send the fourth packet to the TCP layer. In this way, the TCP layer can send the next data packet to the server according to the confirmation number in the fourth packet.

本申请实施例中,接收到来自其他层的第一确认报文时,中间层还根据第一确认报文生成携带上述第一数据的第二数据报文,并丢弃(也可以为过滤、删除)第一确认报文。例如,假设第一确认报文的确认号=200,则中间层可以在缓冲区中查询序号=200的数据报文,并将该数据报文确定为第二数据报文。这样,中间层可以实现在缓冲区找到丢失的数据并进行重传的目的。In this embodiment of the present application, when receiving a first confirmation message from another layer, the intermediate layer also generates a second data message carrying the above-mentioned first data according to the first confirmation message, and discards it (which may also be filtering or deleting ) first acknowledgment message. For example, assuming that the acknowledgment number of the first acknowledgment packet = 200, the intermediate layer may query the buffer for the data packet with the sequence number = 200, and determine the data packet as the second data packet. In this way, the middle layer can find the lost data in the buffer and retransmit it.

S806,中间层向其他层发送第二数据报文,其他层接收来自中间层的第二数据报文。S806, the intermediate layer sends the second data packet to other layers, and the other layers receive the second data packet from the intermediate layer.

类似地,中间层向其他层发送第二数据报文的过程可以参照上述S802,在此不再赘述。Similarly, for the process of the middle layer sending the second data packet to other layers, reference may be made to the above S802, and details are not repeated here.

S807,其他层向服务器发送第二数据报文,服务器接收来自其他层的第二数据报文。S807, the other layers send the second data packet to the server, and the server receives the second data packet from the other layers.

类似地,其他层向服务器发送第二数据报文的过程可以参照上述S803,在此不再赘述。Similarly, for the process of other layers sending the second data packet to the server, reference may be made to the above S803, and details are not repeated here.

可以理解,基于上述S801-S807可知,接收到重传丢失报文的指示时,中间层不仅可以重传丢失报文,还可以过滤该指示,避免TCP层接收到该指示。这样,在客户端与服务端之间的信道并未拥塞的情况下,偶尔丢失报文时,TCP层不会减小拥塞窗口,降低报文发送速率。It can be understood that, based on the above S801-S807, when receiving the instruction to retransmit the lost packet, the intermediate layer can not only retransmit the lost packet, but also filter the instruction to prevent the TCP layer from receiving the instruction. In this way, when the channel between the client and the server is not congested, when packets are occasionally lost, the TCP layer will not reduce the congestion window and reduce the packet sending rate.

在本申请实施例中,如果客户端与服务端之间的信道拥塞,发生大规模丢包时,上述S805还可以包括:第一时间段内,接收到不同确认号的第一确认报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,中间层向TCP层发送第一消息。其中,第一消息用于指示TCP层降低发送速率,比如,第一消息包括多个确认号相同的第一确认报文。这样,客户端与服务端之间的信道拥塞时,中间层可以向TCP层反馈重传丢失报文的指示,使得TCP层减小拥塞窗口,降低报文发送速率,避免客户端与服务端之间的信道进一步拥塞,并改善信道质量。In the embodiment of the present application, if the channel between the client and the server is congested and large-scale packet loss occurs, the above S805 may further include: within the first time period, receiving a first confirmation message with a different confirmation number When the number exceeds the congestion threshold, and/or the packet loss rate reaches the packet loss threshold, the middle layer sends the first message to the TCP layer. The first message is used to instruct the TCP layer to reduce the sending rate. For example, the first message includes multiple first acknowledgment packets with the same acknowledgment number. In this way, when the channel between the client and the server is congested, the middle layer can feed back the indication of retransmission of lost packets to the TCP layer, so that the TCP layer can reduce the congestion window, reduce the packet sending rate, and avoid the communication between the client and the server. further congestion of the inter-channel channel and improve the channel quality.

为了提升手机与服务器之间的数据传输速率,可选地,继续以手机为发送端,服务器为接收端为例,请参照图9,在手机与服务器的连接建立过程中,上述通信方法包括如下几个步骤:In order to improve the data transmission rate between the mobile phone and the server, optionally, continue to take the mobile phone as the sending end and the server as the receiving end as an example, please refer to FIG. 9 , in the process of establishing the connection between the mobile phone and the server, the above communication method includes the following A few steps:

S901,TCP层向中间层发送第一握手报文,中间层接收来自TCP层的第一握手报文。S901, the TCP layer sends a first handshake packet to the intermediate layer, and the intermediate layer receives the first handshake packet from the TCP layer.

其中,第一握手报文包括窗口大小和窗口缩放因子,窗口大小为N1,窗口缩放因子为S1。结合上文对窗口大小和窗口缩放因子的说明可知,手机的接收窗口的长度为N1*2^S1。另外,对于手机而言,第一握手报文相当于携带下行窗口。The first handshake message includes a window size and a window scaling factor, where the window size is N 1 and the window scaling factor is S 1 . Combining the above description of the window size and the window scaling factor, it can be known that the length of the receiving window of the mobile phone is N 1 *2^S 1 . In addition, for the mobile phone, the first handshake message is equivalent to carrying the downlink window.

在实际传输数据时,TCP层不仅会向中间层发送第一握手报文,还会向中间层发送其他TCP报文,因此,中间层可以通过如下第二判断过程,在来自TCP层的TCP报文中确定出第一握手报文。其中,第二判断过程可以包括:中间层判断来自TCP层的TCP报文是否为SYN报文,当来自TCP层的TCP报文是SYN报文时,则确定该SYN报文为第一握手报文。When actually transmitting data, the TCP layer will not only send the first handshake message to the middle layer, but also send other TCP messages to the middle layer. Therefore, the middle layer can pass the second judgment process as follows. The first handshake message is determined in the text. Wherein, the second judgment process may include: the middle layer judges whether the TCP packet from the TCP layer is a SYN packet, and when the TCP packet from the TCP layer is a SYN packet, then determines that the SYN packet is the first handshake packet arts.

本申请实施例中,中间层接收到来自TCP层的第一握手报文时,上述S901还可以包括:中间层根据第一握手报文生成第二握手报文。其中,第二握手报文与第一握手报文不同之处在于窗口大小和窗口缩放因子不同,第二握手报文中的窗口大小为N2,窗口缩放因子为S2,并且,N2*2^S2的值大于或等于N1*2^S1的值。换句话说,第二握手报文指示的手机的接收窗口的长度≥第一握手报文指示的手机的接收窗口的长度。In this embodiment of the present application, when the middle layer receives the first handshake message from the TCP layer, the above S901 may further include: the middle layer generates a second handshake message according to the first handshake message. The difference between the second handshake message and the first handshake message is that the window size and window scaling factor are different. The window size in the second handshake message is N 2 , the window scaling factor is S 2 , and N 2 * The value of 2^S 2 is greater than or equal to the value of N 1 *2^S 1 . In other words, the length of the receiving window of the mobile phone indicated by the second handshake message ≥ the length of the receiving window of the mobile phone indicated by the first handshake message.

示例性地,接收到来自TCP层的第一握手报文时,中间层可以对第一握手报文中的窗口大小和窗口缩放因子进行修改,将窗口大小N1修改为N2、窗口缩放因子S1修改为S2,并将修改后的第一握手报文确定为第二握手报文。其中,N2大于或等于N1,和/或,S2大于或等于S1Exemplarily, when receiving the first handshake message from the TCP layer, the intermediate layer can modify the window size and the window scaling factor in the first handshake message, and modify the window size N1 to N2 , the window scaling factor S 1 is modified to S 2 , and the modified first handshake message is determined as the second handshake message. Wherein, N 2 is greater than or equal to N 1 , and/or S 2 is greater than or equal to S 1 .

S902,中间层向其他层发送第二握手报文,其他层接收来自中间层的第二握手报文。S902, the middle layer sends a second handshake packet to other layers, and the other layers receive the second handshake packet from the middle layer.

S903,其他层向服务器发送第二握手报文,服务器接收来自其他层的第二握手报文。S903, the other layers send the second handshake packet to the server, and the server receives the second handshake packet from the other layers.

本申请实施例中,接收到来自其他层的第二握手报文时,服务器可以生成第三握手报文。其中,第三握手报文包括窗口大小和窗口缩放因子,窗口大小为N3,窗口缩放因子为S3。结合上文对窗口大小和窗口缩放因子的说明可知,服务器的接收窗口的长度为N3*2^S3。另外,对于手机而言,第三握手报文相当于携带上行窗口。In this embodiment of the present application, when receiving a second handshake packet from other layers, the server may generate a third handshake packet. The third handshake message includes a window size and a window scaling factor, where the window size is N 3 and the window scaling factor is S 3 . With reference to the above description of the window size and the window scaling factor, it can be known that the length of the receiving window of the server is N 3 *2^S 3 . In addition, for the mobile phone, the third handshake message is equivalent to carrying the uplink window.

S904,服务器向其他层发送第三握手报文,其他层接收来自服务器的第三握手报文。S904, the server sends a third handshake packet to other layers, and the other layers receive the third handshake packet from the server.

S905,其他层向中间层发送第三握手报文,中间层接收来自其他层的第三握手报文。S905, other layers send a third handshake packet to the intermediate layer, and the intermediate layer receives the third handshake packet from other layers.

在实际传输数据时,其他层不仅会向中间层发送第三握手报文,还会向中间层发送其他TCP报文,因此,中间层可以通过如下第三判断过程,在来自TCP层的TCP报文中确定出第三握手报文。其中,第三判断过程可以包括:中间层判断来自其他层的TCP报文是否为SYN报文,当来自其他层的TCP报文是SYN报文时,则确定该SYN报文为第三握手报文。When actually transmitting data, other layers will not only send the third handshake message to the middle layer, but also send other TCP messages to the middle layer. Therefore, the middle layer can pass the third judgment process as follows, in the TCP message from the TCP layer. The third handshake message is determined in the text. Wherein, the third judgment process may include: the middle layer judges whether the TCP packets from other layers are SYN packets, and when the TCP packets from other layers are SYN packets, then determine that the SYN packet is the third handshake packet arts.

与上述S901类似,接收到来自其他层的第三握手报文时,上述S905还可以包括:中间层根据第三握手报文生成第四握手报文。其中,第四握手报文与第三握手报文不同之处在于窗口大小和窗口缩放因子不同,第四握手报文中的窗口大小为N4,窗口缩放因子为S4,并且,N4*2^S4的值大于或等于N3*2^S3的值。换句话说,第四握手报文指示的服务器的接收窗口的长度≥第三握手报文指示的服务器的接收窗口的长度。Similar to the above S901, when receiving the third handshake packet from other layers, the above S905 may further include: the middle layer generates a fourth handshake packet according to the third handshake packet. The difference between the fourth handshake message and the third handshake message is that the window size and the window scaling factor are different. The window size in the fourth handshake message is N 4 , the window scaling factor is S 4 , and N 4 * The value of 2^S 4 is greater than or equal to the value of N 3 *2^S 3 . In other words, the length of the receiving window of the server indicated by the fourth handshake packet ≥ the length of the receiving window of the server indicated by the third handshake packet.

示例性地,接收到来自其他层的第三握手报文时,中间层可以对第三握手报文中的窗口大小和窗口缩放因子进行修改,将窗口大小N3修改为N4、窗口缩放因子S3修改为S4,并将修改后的第三握手报文确定为第四握手报文。其中,N4大于或等于N3,和/或,S4大于或等于S3Exemplarily, when receiving the third handshake message from other layers, the middle layer can modify the window size and the window scaling factor in the third handshake message, and modify the window size N 3 to N 4 and the window scaling factor. S 3 is modified to S 4 , and the modified third handshake message is determined as the fourth handshake message. Wherein, N 4 is greater than or equal to N 3 , and/or S 4 is greater than or equal to S 3 .

S906,中间层向TCP层发送第四握手报文,TCP层接收来自中间层的第四握手报文。S906, the middle layer sends a fourth handshake packet to the TCP layer, and the TCP layer receives the fourth handshake packet from the middle layer.

S907,TCP向中间层发送第五握手报文,中间层接收来自TCP层的第五握手报文。S907, the TCP sends the fifth handshake packet to the intermediate layer, and the intermediate layer receives the fifth handshake packet from the TCP layer.

其中,第五握手报文用于指示已收到来自服务器的第四握手报文,第五握手报文的实施方式可以参照上述步骤3,在此不再赘述。The fifth handshake packet is used to indicate that the fourth handshake packet has been received from the server. For the implementation of the fifth handshake packet, reference may be made to the foregoing step 3, which will not be repeated here.

S908,中间层向其他层发送第五握手报文,中间层向其他层发送第五握手报文。S908, the middle layer sends a fifth handshake packet to other layers, and the middle layer sends a fifth handshake packet to other layers.

S909,其他层向服务器发送第五握手报文,服务器接收来自其他层的第五握手报文。S909, the other layers send the fifth handshake packet to the server, and the server receives the fifth handshake packet from the other layers.

上述S907-S909与步骤1-步骤3类似,执行完S907-S909后,手机与服务器完成TCP三次握手,手机和服务器均处于连接建立(ESTABLISHED)状态,可以进行数据交互。The above S907-S909 are similar to steps 1-3. After executing S907-S909, the mobile phone and the server complete the TCP three-way handshake, and both the mobile phone and the server are in the ESTABLISHED state, and data can be exchanged.

可选地,继续以手机为发送端,服务器为接收端为例,在手机与服务器的数据传输过程中,图9所示的通信方法还包括以下几个步骤:Optionally, continuing to take the mobile phone as the sending end and the server as the receiving end as an example, during the data transmission process between the mobile phone and the server, the communication method shown in FIG. 9 further includes the following steps:

S910,TCP层向中间层发送第三数据报文,中间层接收来自TCP层的第三数据报文。S910, the TCP layer sends a third data packet to the intermediate layer, and the intermediate layer receives the third data packet from the TCP layer.

其中,第三数据报文包括窗口大小,窗口大小为N5。结合上文对窗口大小和窗口缩放因子的说明可知,手机的接收窗口的长度为N5*2^S5。其中,S5可以为在连接建立过程中被确定下来的窗口缩放因子。另外,对于手机而言,第三数据报文相当于携带下行窗口。Wherein, the third data packet includes a window size, and the window size is N 5 . Combining the above description of the window size and the window scaling factor, it can be known that the length of the receiving window of the mobile phone is N 5 *2^S 5 . Wherein, S5 may be the window scaling factor determined during the connection establishment process. In addition, for the mobile phone, the third data packet is equivalent to carrying the downlink window.

在实际传输数据时,由于TCP层不仅会向中间层发送第三数据报文,还会向中间层发送其他TCP报文,因此,中间层可以通过如下第四判断过程,在来自TCP层的TCP报文中确定出第三数据报文。其中,第四判断过程可以包括:中间层判断来自TCP层的TCP报文是否为数据报文,当来自TCP层的TCP报文是数据报文时,则确定该数据报文为第三数据报文。During actual data transmission, since the TCP layer will not only send the third data packet to the middle layer, but also other TCP packets to the middle layer, the middle layer can pass the fourth judgment process as follows, in the TCP from the TCP layer A third data message is determined in the message. Wherein, the fourth judgment process may include: the middle layer judges whether the TCP packet from the TCP layer is a data packet, and when the TCP packet from the TCP layer is a data packet, then determine that the data packet is the third data packet arts.

本申请实施例中,接收到来自TCP层的第三数据报文时,上述S910还可以包括:中间层根据第三数据报文生成第四数据报文。其中,第四数据报文与第三数据报文不同之处在于窗口大小不同,第四数据报文中的窗口大小为N6,且N6的值大于或等于N5的值。换句话说,第四数据报文指示的手机的接收窗口的长度≥第三数据报文指示的手机的接收窗口的长度。In this embodiment of the present application, when the third data packet from the TCP layer is received, the above S910 may further include: the intermediate layer generates a fourth data packet according to the third data packet. The difference between the fourth data packet and the third data packet is that the window size is different. The window size in the fourth data packet is N 6 , and the value of N 6 is greater than or equal to the value of N 5 . In other words, the length of the receiving window of the mobile phone indicated by the fourth data packet ≥ the length of the receiving window of the mobile phone indicated by the third data packet.

示例性地,接收到来自TCP层的第三数据报文时,中间层可以对第三数据报文中的窗口大小进行修改,将窗口大小N5修改为N6(N6≥N5),并将修改后的第三数据报文确定为第四数据报文。Exemplarily, when receiving the third data packet from the TCP layer, the intermediate layer may modify the window size in the third data packet, and modify the window size N 5 to N 6 (N 6 ≥ N 5 ), The modified third data message is determined as the fourth data message.

S911,中间层向其他层发送第四数据报文,其他层接收来自中间层的第四数据报文。S911, the middle layer sends a fourth data packet to other layers, and the other layers receive the fourth data packet from the middle layer.

S912,其他层向服务器发送第四数据报文,服务器接收来自其他层的第四数据报文。S912, the other layers send a fourth data packet to the server, and the server receives the fourth data packet from the other layers.

本申请实施例中,接收到来自其他层的第四数据报文时,服务器可以生成第二确认报文。其中,第二确认报文包括窗口大小,窗口大小为N7。结合上文对窗口大小和窗口缩放因子的说明可知,服务器的接收窗口的长度为N7*2^S5。另外,对于手机而言,第二确认报文相当于携带上行窗口。In this embodiment of the present application, when receiving the fourth data packet from other layers, the server may generate a second confirmation packet. Wherein, the second confirmation message includes the window size, and the window size is N 7 . With reference to the above description of the window size and the window scaling factor, it can be known that the length of the receiving window of the server is N 7 *2^S 5 . In addition, for the mobile phone, the second confirmation message is equivalent to carrying the uplink window.

S913,服务器向其他层发送第二确认报文,其他层接收来自服务器的第二确认报文。S913, the server sends a second confirmation message to other layers, and the other layers receive the second confirmation message from the server.

S914,其他层向中间层发送第二确认报文,中间层接收来自其他层的第二确认报文。S914, the other layers send the second confirmation message to the middle layer, and the middle layer receives the second confirmation message from the other layers.

在实际传输数据时,其他层不仅会向中间层发送第二确认报文,还会向中间层发送其他TCP报文,因此,中间层可以通过如下第四判断过程,在来自TCP层的TCP报文中确定出第二确认报文。其中,第四判断过程可以包括:中间层判断来自其他层的TCP报文是否为确认报文,当来自其他层的TCP报文是确认报文时,则确定该确认报文为第二确认报文。During actual data transmission, other layers will not only send the second acknowledgment message to the middle layer, but also send other TCP messages to the middle layer. Therefore, the middle layer can pass the following fourth judgment process, in the TCP message from the TCP layer. The second confirmation message is determined in the text. Wherein, the fourth judgment process may include: the middle layer judges whether the TCP packet from other layers is an acknowledgement packet, and when the TCP packet from other layers is an acknowledgement packet, then determines that the acknowledgement packet is the second acknowledgement packet arts.

接收到来自其他层的第二确认报文时,S914还可以包括:中间层根据第二确认报文生成第三确认报文。其中,第三确认报文与第二确认报文不同之处在于窗口大小不同,第三确认报文中的窗口大小为N8,且N8大于或等于N7。换句话说,第三确认报文指示的服务器的接收窗口的长度大于或等于第二确认报文指示的服务器的接收窗口的长度。When receiving the second acknowledgment message from other layers, S914 may further include: the intermediate layer generates a third acknowledgment message according to the second acknowledgment message. The difference between the third acknowledgment message and the second acknowledgment message is that the window size is different, and the window size in the third acknowledgment message is N 8 , and N 8 is greater than or equal to N 7 . In other words, the length of the receiving window of the server indicated by the third acknowledgment packet is greater than or equal to the length of the receiving window of the server indicated by the second acknowledgment packet.

示例性地,在接收到来自其他层的第二确认报文时,中间层可以对第二确认报文中的窗口大小进行修改,将窗口大小N7修改为N8(N8≥N7),并将修改后的第二确认报文确定为第三确认报文。Exemplarily, when receiving the second acknowledgment packet from another layer, the intermediate layer may modify the window size in the second acknowledgment packet, and modify the window size N 7 to N 8 (N 8 ≥N 7 ) , and determine the modified second confirmation message as the third confirmation message.

S915,中间层向TCP层发送第三确认报文,TCP层接收来自中间层的第三确认报文。S915, the middle layer sends a third acknowledgment message to the TCP layer, and the TCP layer receives the third acknowledgment message from the middle layer.

需要说明的是,在图9所示的S901-S915中,TCP层与中间层之间的数据交互,如TCP层与中间层之间进行第一握手报文、第四握手报文、第五握手报文、第三数据报文以及第三确认报文的交互,可以参照上述S801。中间层与其他层之间的数据交互,如中间层与其他层之间进行第二握手报文、第三握手报文、第五握手报文、第四数据报文以及第二确认报文的交互,可以参照上述S802、S807。其他层与服务器之间的数据交换,如其他层与服务器之间进行第二握手报文、第三握手报文、第五握手报文、第四数据报文以及第二确认报文的交互,可以参照上述S803、S803。因此,S901-S915的数据交互过程在此均不再赘述。It should be noted that, in S901-S915 shown in FIG. 9, the data interaction between the TCP layer and the middle layer, such as the first handshake message, the fourth handshake message, the fifth handshake message between the TCP layer and the middle layer For the interaction of the handshake message, the third data message, and the third confirmation message, reference may be made to S801 above. Data interaction between the middle layer and other layers, such as the second handshake message, the third handshake message, the fifth handshake message, the fourth data message, and the second acknowledgment message between the middle layer and other layers. For interaction, refer to S802 and S807 above. Data exchange between other layers and the server, such as the interaction of the second handshake message, the third handshake message, the fifth handshake message, the fourth data message and the second confirmation message between other layers and the server, Refer to S803 and S803 above. Therefore, the data interaction process of S901-S915 will not be repeated here.

上述S901-S909与S910-S915可以结合实施,也可以单独实施,本申请实施例对此不作限定。The foregoing S901-S909 and S910-S915 may be implemented in combination, or may be implemented independently, which is not limited in this embodiment of the present application.

基于上述S901-S903、S910-S912可知,中间层可以截取手机向服务器发送的SYN报文或数据报文,并放大SYN报文或数据报文中的窗口大小,和/或,窗口缩放因子,以及向服务器发送放大后的窗口大小,和/或,窗口缩放因子。这样,可以使得服务器认为手机的接收缓存充足,从而使得服务器以更高的速率向手机发送数据,提高TCP传输速率。Based on the above S901-S903, S910-S912, it can be known that the middle layer can intercept the SYN message or data message sent by the mobile phone to the server, and enlarge the window size in the SYN message or data message, and/or, the window scaling factor, And send the enlarged window size, and/or the window scaling factor to the server. In this way, the server can be made to think that the receiving buffer of the mobile phone is sufficient, so that the server can send data to the mobile phone at a higher rate and increase the TCP transmission rate.

类似地,基于上述S904-S906、S913-S915可知,中间层可以截取服务器向手机发送的SYN报文或数据报文,并放大SYN报文或数据报文中的窗口大小,和/或,窗口缩放因子,以及向手机发送放大后的窗口大小,和/或,窗口缩放因子。这样,可以使得手机的TCP层认为服务器的接收缓存充足,从而使得手机以更高的速率向服务器发送数据,提高TCP传输速率。Similarly, based on the above S904-S906, S913-S915, the middle layer can intercept the SYN message or data message sent by the server to the mobile phone, and enlarge the window size in the SYN message or data message, and/or, the window The zoom factor, and the zoomed-in window size, and/or the window zoom factor, is sent to the phone. In this way, the TCP layer of the mobile phone can be made to think that the receiving buffer of the server is sufficient, so that the mobile phone can send data to the server at a higher rate and increase the TCP transmission rate.

另外,为了统一说明,第一握手报文、第三数据报文指示的手机的接收窗口的长度可以被称为修改前的手机的接收窗口的长度,第三握手报文、第二确认报文指示的服务器的接收窗口的长度可以被称为修改前的服务器的接收窗口的长度。In addition, for unified description, the length of the receiving window of the mobile phone indicated by the first handshake message and the third data message may be referred to as the length of the receiving window of the mobile phone before modification, the third handshake message and the second confirmation message. The length of the indicated server's receive window may be referred to as the length of the server's receive window before modification.

可选地,手机与服务器在进行数据交互时,在下行方向(即手机接收服务器的数据报文),通过其他层接收到来自服务器的数据报文时,中间层可以将这些数据报文暂存在缓冲区中,并且,中间层还可以按上述修改前的手机的接收窗口的长度向TCP层发送来自服务器的数据报文。这样,可以避免因数据过多而导致TCP层的接收窗口过载出错。Optionally, when the mobile phone and the server are performing data exchange, in the downstream direction (that is, the mobile phone receives data packets from the server), when receiving data packets from the server through other layers, the intermediate layer can temporarily store these data packets. In addition, the middle layer can also send the data message from the server to the TCP layer according to the length of the receiving window of the mobile phone before the modification. In this way, the overload error of the receiving window of the TCP layer due to too much data can be avoided.

例如,在下行方向,假设由于突发的信道拥塞或丢包等原因,服务器将发送窗口的长度降低到100字节,而手机TCP层的接收窗口的长度为500字节。在此情况下,为了提高服务器的发送速率,中间层可以通过执行上述S901-S903或S910-S912,向服务器发送放大后的TCP层的接收窗口的长度(比如,1200字节),以使服务器增加发送窗口的长度,比如,服务器的发送窗口的长度被增大到1000字节。然后,服务器以1000字节的窗口长度发送报文。中间层以1000字节的窗口长度接收来自服务器的报文,并以修改前的手机TCP层的接收窗口的长度(500字节)向TCP层发送来自服务器的报文。如此,既能够提高服务器的数据发送速率,又能够避免因数据过多而导致TCP层的接收窗口过载出错。For example, in the downstream direction, suppose that due to sudden channel congestion or packet loss, etc., the server reduces the length of the send window to 100 bytes, while the length of the receive window of the mobile phone TCP layer is 500 bytes. In this case, in order to improve the sending rate of the server, the middle layer can send the amplified receiving window length of the TCP layer (for example, 1200 bytes) to the server by executing the above S901-S903 or S910-S912, so that the server can Increase the length of the send window, for example, the length of the server's send window is increased to 1000 bytes. The server then sends the message with a window length of 1000 bytes. The middle layer receives the message from the server with the window length of 1000 bytes, and sends the message from the server to the TCP layer with the length (500 bytes) of the receiving window of the mobile phone TCP layer before modification. In this way, the data sending rate of the server can be improved, and the overload error of the receiving window of the TCP layer caused by too much data can be avoided.

相应地,在上行方向(即手机向服务器发送数据报文),接收到来自TCP层的数据报文时,中间层可以将这些数据报文暂存在缓冲区中,并且,中间层还可以按上述修改前的服务器的接收窗口的长度向服务器发送来自TCP层的数据报文。这样,可以避免因数据过多而导致服务器的接收窗口过载出错。Correspondingly, in the uplink direction (that is, the mobile phone sends data packets to the server), when receiving data packets from the TCP layer, the intermediate layer can temporarily store these data packets in the buffer, and the intermediate layer can also press the above-mentioned data packets. The length of the receive window of the server before modification is used to send data packets from the TCP layer to the server. In this way, you can avoid overloading the server's receive window due to too much data.

例如,在上行方向,假设由于突发的信道拥塞或丢包等原因,手机的TCP层将发送窗口的长度降低到100字节,而服务器的接收窗口的长度为500字节。在此情况下,为了提高TCP层的发送速率,中间层可以通过执行上述S904-S906或S913-S915,向TCP层发送放大后的服务器的接收窗口的长度(比如,1200字节),以使TCP层增加发送窗口的长度,比如,TCP层的发送窗口的长度被增大到1000字节。然后,TCP层以1000字节的窗口长度发送报文。中间层以1000字节的窗口长度接收来自TCP层的报文,并以修改前的服务器接收窗口的长度(500字节)向服务器发送来自TCP层的报文。如此,既能够提高TCP层的发送速率,又能够避免因数据过多而导致服务器的接收窗口过载出错。For example, in the upstream direction, suppose that due to sudden channel congestion or packet loss, etc., the TCP layer of the mobile phone reduces the length of the send window to 100 bytes, while the length of the server's receive window is 500 bytes. In this case, in order to improve the sending rate of the TCP layer, the middle layer can send the amplified length of the server's receiving window (for example, 1200 bytes) to the TCP layer by executing the above S904-S906 or S913-S915, so that the The TCP layer increases the length of the send window, for example, the length of the send window of the TCP layer is increased to 1000 bytes. Then, the TCP layer sends the message with a window length of 1000 bytes. The middle layer receives the message from the TCP layer with the window length of 1000 bytes, and sends the message from the TCP layer to the server with the length of the server receiving window before modification (500 bytes). In this way, the sending rate of the TCP layer can be improved, and errors caused by overloading the receiving window of the server due to excessive data can be avoided.

其中,为了统一说明,上述窗口大小和窗口缩放因子可以被称为窗口指示信息,第一握手报文、第三握手报文、第三数据报文以及第二确认报文可以被称为第二报文,第二握手报文、第四握手报文、第四数据报文以及第三确认报文可以被称为第三报文。客户端维护的接收窗口可以被称为下行窗口,服务端维护的接收窗口可以被称为上行窗口。Wherein, for unified description, the above-mentioned window size and window scaling factor may be referred to as window indication information, and the first handshake message, the third handshake message, the third data message, and the second confirmation message may be referred to as the second The messages, the second handshake message, the fourth handshake message, the fourth data message, and the third acknowledgment message may be referred to as third messages. The receiving window maintained by the client can be called the downlink window, and the receiving window maintained by the server can be called the uplink window.

不同业务对数据传输速率以及传输时延的需求不同,例如,游戏业务对数据传输速率、传输时延要求很高,语音业务对数据传输速率、传输时延则相对较低。为了使得不同业务的数据传输速率以及传输时延更加合理,可选地,中间层根据第二报文对应的业务修改第二报文中的窗口指示信息。换句话说,第二报文中的窗口指示信息由第二报文对应的业务确定。Different services have different requirements for data transmission rate and transmission delay. For example, game services have high requirements for data transmission rate and transmission delay, while voice services have relatively low requirements for data transmission rate and transmission delay. In order to make the data transmission rate and transmission delay of different services more reasonable, optionally, the middle layer modifies the window indication information in the second packet according to the service corresponding to the second packet. In other words, the window indication information in the second packet is determined by the service corresponding to the second packet.

示例性地,请参照图10,继续以第一设备为手机举例。手机中包括用户态和内核态,中间层运行在内核态,业务运行在用户态。该业务可以包括:游戏业务、语音业务、视频业务以及其他业务等,业务可以是手机中安装的各种应用程序(application,APP)。Exemplarily, please refer to FIG. 10, and continue to take the first device as a mobile phone as an example. The mobile phone includes user mode and kernel mode, the middle layer runs in the kernel mode, and the business runs in the user mode. The services may include game services, voice services, video services, and other services, and the services may be various application programs (application, APP) installed in the mobile phone.

手机的用户态中还可以包括处理应用程序,业务可以向该处理应用程序发送业务的ID和五元组信息,处理应用程序可以接收来自业务的ID和五元组信息。其中,五元组信息可以包括:源IP(internet protocol,互联网协议)地址,源端口,目的IP地址,目的端口和传输层协议类型。The user state of the mobile phone may further include a processing application, the service may send the service ID and quintuple information to the processing application, and the processing application may receive the service ID and quintuple information. The quintuple information may include: source IP (internet protocol, Internet Protocol) address, source port, destination IP address, destination port and transport layer protocol type.

接收到来自业务的ID和五元组信息时,处理应用程序可以根据业务的ID和五元组信息,确定业务对应的窗口的长度。其中,业务对应的窗口的长度可以包括上行窗口的长度,和/或,下行窗口的长度。When receiving the ID and quintuple information from the service, the processing application can determine the length of the window corresponding to the service according to the service ID and quintuple information. The length of the window corresponding to the service may include the length of the uplink window and/or the length of the downlink window.

以游戏业务为例,处理应用程序中可以包括:游戏业务的ID与服务质量(qualityof service,QoS)的需求的第一对应关系,以及Qos的需求与窗口的长度的第二对应关系。接收到来自游戏业务的ID和五元组信息时,处理应用程序可以根据第一对应关系和游戏业务的ID确定游戏业务的QoS的需求,然后根据第二对应关系和游戏业务的Qos的需求确定游戏业务的上行窗口的长度,和/或,下行窗口的长度。Taking the game service as an example, the processing application may include: a first correspondence between the ID of the game service and the requirement of quality of service (QoS), and a second correspondence between the requirement of QoS and the length of the window. When receiving the ID and quintuple information from the game service, the processing application can determine the QoS requirements of the game service according to the first correspondence and the ID of the game service, and then determine the QoS requirements of the game service according to the second correspondence and the game service. The length of the upstream window of the game service, and/or the length of the downstream window.

可选地,Qos可以包括吞吐量,上述第二对应关系中,吞吐量与窗口的长度成正比关系。也即是说,吞吐量越大,窗口的长度越大。Optionally, the Qos may include throughput, and in the foregoing second correspondence, the throughput is proportional to the length of the window. That is, the greater the throughput, the greater the length of the window.

确定出业务对应的窗口的长度时,处理应用程序还可以向中间层发送业务对应的窗口的长度以及五元组信息,中间层接收并将来自处理应用程序的业务对应的窗口的长度以及五元组信息存储在缓存中。其中,业务对应的窗口的长度以及五元组信息可以承载在窗口修改报文中。When the length of the window corresponding to the service is determined, the processing application can also send the length of the window corresponding to the service and the quintuple information to the middle layer, and the middle layer receives and converts the length and quintuple of the window corresponding to the service from the processing application. Group information is stored in the cache. The length of the window corresponding to the service and the quintuple information may be carried in the window modification message.

接收到第二报文时,中间层可以确定第二报文对应的五元组信息,然后根据第二报文对应的五元组信息确定第二报文对应的窗口的长度,进而根据第二报文对应的窗口的长度修改第二报文中的窗口指示信息,最后将修改后的第二报文确定为第三报文。When receiving the second packet, the intermediate layer can determine the quintuple information corresponding to the second packet, and then determine the length of the window corresponding to the second packet according to the quintuple information corresponding to the second packet, and then determine the length of the window corresponding to the second packet according to the second packet. The length of the window corresponding to the message modifies the window indication information in the second message, and finally the modified second message is determined as the third message.

比如,结合上述图9和下表2,表2示出的是中间层存储的部分业务对应的窗口的长度以及五元组信息。以中间层接收到第一握手报文(携带的是下行窗口)举例,首先中间层解析第一握手报文的五元组信息,假设第一握手报文的五元组信息为五元组2,那么中间层可以将五元组2对应的下行窗口的长度确定为第一握手报文对应的窗口的长度,进而可以将第一握手报文中的窗口大小修改为N12,窗口缩放因子修改为S12,最后将修改后的第一握手报文确定为第二握手报文。或者,以中间层接收到第三握手报文(携带的是上行窗口)举例,首先中间层解析第三握手报文的五元组信息,假设第三握手报文的五元组信息为五元组3,那么中间层可以将五元组3对应的上行窗口的长度确定为第三握手报文对应的窗口的长度,进而可以将第三握手报文中的窗口大小修改为N13,窗口缩放因子修改为S13,最后将修改后的第三握手报文确定为第四握手报文。For example, with reference to the above FIG. 9 and Table 2 below, Table 2 shows the window length and quintuple information corresponding to some services stored in the middle layer. Taking the middle layer receiving the first handshake packet (carrying the downlink window) as an example, first the middle layer parses the quintuple information of the first handshake packet, assuming that the quintuple information of the first handshake packet is quintuple 2 , then the middle layer can determine the length of the downlink window corresponding to quintuple 2 as the length of the window corresponding to the first handshake message, and then can modify the window size in the first handshake message to N 12 , and modify the window scaling factor As S 12 , the modified first handshake message is finally determined as the second handshake message. Or, taking the middle layer receiving the third handshake packet (carrying the upstream window) as an example, first, the middle layer parses the quintuple information of the third handshake packet, assuming that the quintuple information of the third handshake packet is quintuple group 3, then the middle layer can determine the length of the uplink window corresponding to the quintuple 3 as the length of the window corresponding to the third handshake packet, and then can modify the window size in the third handshake packet to N 13 , and the window is scaled The factor is modified to S 13 , and finally the modified third handshake message is determined as the fourth handshake message.

表2Table 2

Figure BDA0002991067640000191
Figure BDA0002991067640000191

又比如,再结合上述图9和表2。以中间层接收到第三数据报文(携带的是下行窗口)举例,首先中间层解析第三数据报文的五元组信息,假设第三数据报文的五元组信息为五元组3,那么中间层可以将五元组3对应的下行窗口的长度确定为第三数据报文对应的窗口的长度,进而可以将第三数据报文中的窗口大小修改为N14,最后将修改后的第三数据报文确定为第四数据报文。或者,以中间层接收到第二确认报文(携带的是上行窗口)举例,首先中间层解析第二确认报文的五元组信息,假设第二确认报文的五元组信息为五元组4,那么中间层可以将五元组4对应的上行窗口的长度确定为第二确认报文对应的窗口的长度,进而可以将第二确认报文中的窗口大小修改为N15,最后将修改后的第二确认报文确定为第三确认报文。For another example, the above-mentioned FIG. 9 and Table 2 are combined. Taking the middle layer receiving the third data packet (carrying the downlink window) as an example, first, the middle layer parses the quintuple information of the third data packet, assuming that the quintuple information of the third data packet is quintuple 3 , then the intermediate layer can determine the length of the downlink window corresponding to the quintuple 3 as the length of the window corresponding to the third data packet, and then can modify the window size in the third data packet to N 14 , and finally modify the modified The third data packet is determined to be the fourth data packet. Or, taking the middle layer receiving the second acknowledgment packet (carrying the upstream window) as an example, first, the middle layer parses the quintuple information of the second acknowledgment packet, assuming that the quintuple information of the second acknowledgment packet is quintuple information group 4, then the middle layer can determine the length of the uplink window corresponding to the quintuple 4 as the length of the window corresponding to the second acknowledgment packet, and then can modify the window size in the second acknowledgment packet to N 15 , and finally set the The modified second confirmation message is determined to be the third confirmation message.

基于上述图10及相应的说明可知,中间层可以根据业务修改报文中的窗口指示信息,从而修改业务对应的上行窗口或下行窗口,例如,可以将吞吐量大的业务对应的上行窗口或下行窗口调大,将吞吐量小的业务对应的上行窗口或下行窗口调小。这样,可以使得不同业务的数据传输速率以及传输时延更加合理。Based on the above Figure 10 and the corresponding description, the middle layer can modify the window indication information in the message according to the service, so as to modify the uplink window or downlink window corresponding to the service. For example, the uplink window or downlink window corresponding to the service with high throughput can be modified. When the window is increased, the uplink window or downlink window corresponding to the service with low throughput is reduced. In this way, the data transmission rate and transmission delay of different services can be made more reasonable.

以上结合图8-图10详细说明了本申请实施例提供的通信方法。以下结合图11、图12详细说明用于执行本申请实施例提供的通信方法的通信装置。The communication method provided by the embodiment of the present application has been described in detail above with reference to FIG. 8 to FIG. 10 . A communication device for executing the communication method provided by the embodiment of the present application will be described in detail below with reference to FIG. 11 and FIG. 12 .

示例性地,图11是本申请实施例提供的通信装置的结构示意图一。如图11所示,通信装置1100包括:处理模块1101和收发模块1102。处理模块1101包括通信装置1100的TCP层和中间层,中间层为TCP层的下层。为了便于说明,图11仅示出了该通信装置的主要部件。Exemplarily, FIG. 11 is a first structural schematic diagram of a communication apparatus provided by an embodiment of the present application. As shown in FIG. 11 , the communication apparatus 1100 includes: a processing module 1101 and a transceiver module 1102 . The processing module 1101 includes the TCP layer and the middle layer of the communication device 1100, and the middle layer is the lower layer of the TCP layer. For convenience of explanation, FIG. 11 only shows the main components of the communication device.

一些实施例中,通信装置1100可适用于上文图4所述的通信系统,执行该通信系统中第一设备的功能。In some embodiments, the communication apparatus 1100 can be applied to the communication system described above in FIG. 4 to perform the function of the first device in the communication system.

其中,通信装置1100的中间层,用于利用收发模块1102接收来自第二设备的第一报文,第一报文指示TCP层重传第一数据。通信装置1100的中间层,还用于丢弃第一报文,并利用收发模块1102向第二设备发送第一数据。The middle layer of the communication apparatus 1100 is configured to use the transceiver module 1102 to receive a first packet from the second device, where the first packet instructs the TCP layer to retransmit the first data. The middle layer of the communication apparatus 1100 is further configured to discard the first packet, and use the transceiver module 1102 to send the first data to the second device.

一种可能的设计方案中,通信装置1100的中间层,还用于缓存来自TCP层,和/或,第二设备的报文。In a possible design solution, the middle layer of the communication apparatus 1100 is further configured to buffer the packets from the TCP layer and/or the second device.

一种可能的设计方案中,通信装置1100的中间层,还用于确定所有来自第二设备的报文中确认号相同的多个确认报文。通信装置1100的中间层,还用于确定该多个确认报文中的第n个确认报文为第一报文,n可以为大于或等于2的整数。In a possible design solution, the middle layer of the communication apparatus 1100 is further configured to determine multiple acknowledgment packets with the same acknowledgment number in all packets from the second device. The middle layer of the communication device 1100 is further configured to determine the nth confirmation message in the plurality of confirmation messages as the first message, where n may be an integer greater than or equal to 2.

可选地,n可以为2。Optionally, n can be 2.

一种可能的设计方案中,第一报文携带选择确认SACK选项,SACK选项用于指示TCP层重传第一数据。In a possible design solution, the first packet carries a selection acknowledgment SACK option, and the SACK option is used to instruct the TCP layer to retransmit the first data.

一种可能的设计方案中,通信装置1100的中间层,还用于在第一时间段内收到不同确认号的第一报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,利用收发模块1102向TCP层发送第一消息。其中,第一消息用于指示TCP层降低发送速率。In a possible design solution, the middle layer of the communication device 1100 is further configured to receive, within the first time period, the number of first packets with different acknowledgment numbers that exceeds the congestion threshold, and/or the packet loss rate reaches the packet loss rate. When the threshold is reached, the transceiver module 1102 is used to send the first message to the TCP layer. The first message is used to instruct the TCP layer to reduce the sending rate.

一种可能的设计方案中,通信装置1100的中间层,还用于利用收发模块1102接收第二报文。其中,第二报文可以包括第一窗口指示信息,第一窗口指示信息指示第一窗口的长度。通信装置1100的中间层,还用于利用收发模块1102发送第三报文。其中,第三报文可以包括第二窗口指示信息,第二窗口指示信息指示第二窗口的长度,第二窗口的长度大于或等于第一窗口的长度。In a possible design solution, the middle layer of the communication device 1100 is further configured to receive the second packet by using the transceiver module 1102 . The second packet may include first window indication information, where the first window indication information indicates the length of the first window. The middle layer of the communication device 1100 is also used for sending the third message by using the transceiver module 1102 . The third packet may include second window indication information, where the second window indication information indicates the length of the second window, and the length of the second window is greater than or equal to the length of the first window.

可选地,第一窗口指示信息可以包括第一窗口缩放因子字段和第一窗口大小字段,第二窗口指示信息可以包括第二窗口缩放因子字段和第二窗口大小字段。第二窗口的长度大于或等于第一窗口的长度,可以包括如下一项或多项:第二窗口缩放因子字段的值大于或等于第一窗口缩放因子字段的值,或者,第二窗口大小字段的值大于或等于第一窗口大小字段的值。Optionally, the first window indication information may include a first window scaling factor field and a first window size field, and the second window indication information may include a second window scaling factor field and a second window size field. The length of the second window is greater than or equal to the length of the first window, and may include one or more of the following: the value of the second window scaling factor field is greater than or equal to the value of the first window scaling factor field, or, the second window size field The value of is greater than or equal to the value of the first window size field.

可选地,上述第二窗口可以为第二设备的接收窗口。通信装置1100的中间层,还用于利用收发模块1102接收来自第二设备的第二报文。通信装置1100的中间层,还用于利用收发模块1102向TCP层发送第三报文,第二窗口指示信息用于确定通信装置1100的发送窗口。Optionally, the above-mentioned second window may be a receiving window of the second device. The middle layer of the communication apparatus 1100 is further configured to use the transceiver module 1102 to receive the second message from the second device. The middle layer of the communication device 1100 is further configured to send a third packet to the TCP layer by using the transceiver module 1102 , and the second window indication information is used to determine the sending window of the communication device 1100 .

进一步地,通信装置1100的中间层,还用于利用收发模块1102并依据第一窗口指示信息所指示的第一窗口的长度向第二设备发送数据报文。Further, the middle layer of the communication apparatus 1100 is further configured to use the transceiver module 1102 to send a data packet to the second device according to the length of the first window indicated by the first window indication information.

可选地,上述第二窗口可以为通信装置1100的接收窗口。通信装置1100的中间层,还用于利用收发模块1102接收来自TCP层的第二报文。通信装置1100的中间层,还用于利用收发模块1102向第二设备发送第三报文,第二窗口指示信息用于确定第二设备的发送窗口。Optionally, the above-mentioned second window may be a receiving window of the communication apparatus 1100 . The middle layer of the communication device 1100 is further configured to use the transceiver module 1102 to receive the second packet from the TCP layer. The middle layer of the communication apparatus 1100 is further configured to use the transceiver module 1102 to send a third packet to the second device, and the second window indication information is used to determine the sending window of the second device.

进一步地,通信装置1100的中间层,还用于利用收发模块1102并依据所指示的第一窗口的长度向TCP层发送该数据报文。Further, the middle layer of the communication device 1100 is further configured to use the transceiver module 1102 to send the data packet to the TCP layer according to the indicated length of the first window.

可选地,上述第二窗口指示信息可以由第二报文对应的业务确定。Optionally, the above-mentioned second window indication information may be determined by the service corresponding to the second packet.

一种可能的设计方案中,通信装置1100的中间层,还用于利用收发模块1102接收来自第二设备的第四报文。其中,第四报文为确认报文。通信装置1100的中间层,还用于判断中间层已接收的所有确认报文中是否存在第五报文。其中,第五报文的确认号与第四报文的确认号相同。通信装置1100的中间层,还用于若中间层已接收的所有确认报文中不存在第五报文,则利用收发模块1102向TCP层发送第四报文。In a possible design solution, the middle layer of the communication apparatus 1100 is further configured to use the transceiver module 1102 to receive the fourth packet from the second device. The fourth message is an acknowledgement message. The middle layer of the communication device 1100 is further configured to determine whether there is a fifth message in all the confirmation messages received by the middle layer. The confirmation number of the fifth message is the same as the confirmation number of the fourth message. The middle layer of the communication device 1100 is further configured to use the transceiver module 1102 to send the fourth message to the TCP layer if the fifth message does not exist in all the confirmation messages received by the middle layer.

一种可能的设计方案中,中间层位于TCP层与IP层之间。In a possible design solution, the middle layer is located between the TCP layer and the IP layer.

可选地,收发模块1102可以包括接收模块和发送模块(图11中未示出)。其中,发送模块用于实现通信装置1100的发送功能,接收模块用于实现通信装置1100的接收功能。Optionally, the transceiver module 1102 may include a receiving module and a transmitting module (not shown in FIG. 11 ). The sending module is used to implement the sending function of the communication device 1100 , and the receiving module is used to implement the receiving function of the communication device 1100 .

可选地,通信装置1100还可以包括存储模块(图11中未示出),该存储模块存储有程序或指令。当处理模块1101执行该程序或指令时,使得通信装置1100可以执行第一设备的功能。Optionally, the communication apparatus 1100 may further include a storage module (not shown in FIG. 11 ), where the storage module stores programs or instructions. When the processing module 1101 executes the program or instruction, the communication apparatus 1100 can perform the function of the first device.

应理解,通信装置1100中涉及的处理模块1101可以由处理器或处理器相关电路组件实现,可以为处理器或处理单元;收发模块1102可以由收发器或收发器相关电路组件实现,可以为收发器或收发单元。另外,上述处理模块1101也可以被称为处理单元1101,收发模块1102也可以被称为收发单元1102。It should be understood that the processing module 1101 involved in the communication device 1100 may be implemented by a processor or a processor-related circuit component, and may be a processor or a processing unit; the transceiver module 1102 may be implemented by a transceiver or a transceiver-related circuit component, and may be a transceiver module Receiver or Transceiver Unit. In addition, the above-mentioned processing module 1101 may also be referred to as a processing unit 1101 , and the transceiver module 1102 may also be referred to as a transceiver unit 1102 .

需要说明的是,通信装置1100可以是第一设备,也可以是设置于上述第一设备的芯片(系统)或其他部件或组件,或者包含该第一设备的装置,本申请对此不做限定。It should be noted that the communication device 1100 may be the first device, or may be a chip (system) or other components or components provided in the above-mentioned first device, or a device including the first device, which is not limited in this application. .

此外,通信装置1100的技术效果可以参考上述方法实施例所述的通信方法的技术效果,此处不再赘述。In addition, for the technical effect of the communication apparatus 1100, reference may be made to the technical effect of the communication method described in the above method embodiments, which will not be repeated here.

示例性地,图12为本申请实施例提供的通信装置的结构示意图二。该通信装置可以是上述第一设备,也可以是设置于第一设备的芯片(系统)或其他部件或组件。如图12所示,通信装置1200可以包括处理器1201。可选地,通信装置1200还可以包括存储器1202和/或收发器1203。其中,处理器1201与存储器1202和收发器1203耦合,如可以通过通信总线连接。Exemplarily, FIG. 12 is a second schematic structural diagram of a communication apparatus provided by an embodiment of the present application. The communication device may be the above-mentioned first device, or may be a chip (system) or other components or assemblies provided in the first device. As shown in FIG. 12 , the communication apparatus 1200 may include a processor 1201 . Optionally, the communication device 1200 may further include a memory 1202 and/or a transceiver 1203 . Wherein, the processor 1201 is coupled with the memory 1202 and the transceiver 1203, such as can be connected through a communication bus.

下面结合图12对通信装置1200的各个构成部件进行具体的介绍:Each component of the communication device 1200 will be described in detail below with reference to FIG. 12 :

其中,处理器1201是通信装置1200的控制中心,可以是一个处理器,也可以是多个处理元件的统称。例如,处理器1201是一个或多个中央处理器(central processing unit,CPU),也可以是特定集成电路(application specific integrated circuit,ASIC),或者是被配置成实施本申请实施例的一个或多个集成电路,例如:一个或多个微处理器(digital signal processor,DSP),或,一个或者多个现场可编程门阵列(fieldprogrammable gate array,FPGA)。The processor 1201 is the control center of the communication device 1200, which may be one processor or a general term for multiple processing elements. For example, the processor 1201 is one or more central processing units (CPUs), may also be a specific integrated circuit (application specific integrated circuit, ASIC), or is configured to implement one or more embodiments of the present application An integrated circuit, for example: one or more microprocessors (digital signal processors, DSP), or, one or more field programmable gate arrays (field programmable gate array, FPGA).

可选地,处理器1201可以通过运行或执行存储在存储器1202内的软件程序,以及调用存储在存储器1202内的数据,执行通信装置1200的各种功能。Optionally, the processor 1201 may execute various functions of the communication device 1200 by running or executing software programs stored in the memory 1202 and calling data stored in the memory 1202 .

在具体的实现中,作为一种实施例,处理器1201可以包括一个或多个CPU,例如图12中所示出的CPU0和CPU1。In a specific implementation, as an embodiment, the processor 1201 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG. 12 .

在具体实现中,作为一种实施例,通信装置1200也可以包括多个处理器,例如图12中所示的处理器1201和处理器1204。这些处理器中的每一个可以是一个单核处理器(single-CPU),也可以是一个多核处理器(multi-CPU)。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。In a specific implementation, as an embodiment, the communication apparatus 1200 may also include multiple processors, for example, the processor 1201 and the processor 1204 shown in FIG. 12 . Each of these processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).

其中,所述存储器1202用于存储执行本申请方案的软件程序,并由处理器1201来控制执行,具体实现方式可以参考上述方法实施例,此处不再赘述。The memory 1202 is used to store the software program for executing the solution of the present application, and is controlled and executed by the processor 1201. For the specific implementation, reference may be made to the above method embodiments, which will not be repeated here.

可选地,存储器1202可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compactdisc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器1202可以和处理器1201集成在一起,也可以独立存在,并通过通信装置1200的接口电路(图12中未示出)与处理器1201耦合,本申请实施例对此不作具体限定。Alternatively, memory 1202 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (RAM), or a random access memory (RAM) or other type of static storage device that can store information and instructions. Other types of dynamic storage devices for instructions, also can be electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), compact disc read-only memory (CD-ROM) or other optical disk storage , optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage device, or capable of carrying or storing desired program code in the form of instructions or data structures and Any other medium that can be accessed by a computer, but is not limited to this. The memory 1202 may be integrated with the processor 1201, or may exist independently, and be coupled to the processor 1201 through an interface circuit (not shown in FIG. 12) of the communication device 1200, which is not specifically limited in this embodiment of the present application.

收发器1203,用于与其他通信装置之间的通信。例如,通信装置1200为客户端,收发器1203可以用于与服务器通信。The transceiver 1203 is used for communication with other communication devices. For example, the communication device 1200 is a client and the transceiver 1203 can be used to communicate with the server.

可选地,收发器1203可以包括接收器和发送器(图12中未单独示出)。其中,接收器用于实现接收功能,发送器用于实现发送功能。Optionally, the transceiver 1203 may include a receiver and a transmitter (not shown separately in FIG. 12). Among them, the receiver is used to realize the receiving function, and the transmitter is used to realize the sending function.

可选地,收发器1203可以和处理器1201集成在一起,也可以独立存在,并通过通信装置1200的接口电路(图12中未示出)与处理器1201耦合,本申请实施例对此不作具体限定。Optionally, the transceiver 1203 may be integrated with the processor 1201, or may exist independently, and be coupled to the processor 1201 through an interface circuit (not shown in FIG. 12 ) of the communication device 1200, which is not made in this embodiment of the present application Specific restrictions.

需要说明的是,图12中示出的通信装置1200的结构并不构成对该通信装置的限定,实际的通信装置可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。It should be noted that the structure of the communication device 1200 shown in FIG. 12 does not constitute a limitation on the communication device, and an actual communication device may include more or less components than those shown in the figure, or combine some components, or Different component arrangements.

此外,通信装置1200的技术效果可以参考上述方法实施例所述的通信方法的技术效果,此处不再赘述。In addition, for the technical effect of the communication apparatus 1200, reference may be made to the technical effect of the communication method described in the above method embodiments, which will not be repeated here.

本实施例还提供一种通信系统。该通信系统包括一个或多个第一设备和一个或多个第二设备。第一设备包括TCP层和中间层,中间层为TCP层的下层。This embodiment also provides a communication system. The communication system includes one or more first devices and one or more second devices. The first device includes a TCP layer and an intermediate layer, and the intermediate layer is a lower layer of the TCP layer.

在本申请的描述中,除非另有说明,“至少一个”是指一个或多个,“多个”是指两个或多于两个。另外,为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。In the description of this application, unless stated otherwise, "at least one" means one or more, and "plurality" means two or more. In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with basically the same function and effect. Those skilled in the art can understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like are not necessarily different.

另外,在本申请实施例中,“示例地”、“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用示例的一词旨在以具体方式呈现概念。In addition, in the embodiments of the present application, words such as "exemplarily" and "for example" are used to represent examples, illustrations or illustrations. Any embodiment or design described in this application as "exemplary" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the word example is intended to present a concept in a concrete way.

本申请实施例中,有时候下标如W1可能会笔误为非下标的形式如W1,在不强调其区别时,其所要表达的含义是一致的。In the embodiments of the present application, sometimes a subscript such as W1 may be mistakenly written in a non-subscript form such as W1. When the difference is not emphasized, the meaning to be expressed is the same.

应理解,在本申请实施例中的处理器可以是中央处理单元(central processingunit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signalprocessor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that the processor in the embodiments of the present application may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application-specific integrated circuits ( application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

还应理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的随机存取存储器(random accessmemory,RAM)可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。It should also be understood that the memory in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically programmable Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. Volatile memory may be random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory Access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access Memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DR RAM).

上述实施例,可以全部或部分地通过软件、硬件(如电路)、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令或计算机程序。在计算机上加载或执行所述计算机指令或计算机程序时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘。The above embodiments may be implemented in whole or in part by software, hardware (eg, circuits), firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server or data center by wire (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that contains one or more sets of available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media. The semiconductor medium may be a solid state drive.

应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A,B可以是单数或者复数。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系,但也可能表示的是一种“和/或”的关系,具体可参考前后文进行理解。It should be understood that the term "and/or" in this document is only an association relationship to describe associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, and A and B exist at the same time , there are three cases of B alone, where A and B can be singular or plural. In addition, the character "/" in this document generally indicates that the related objects before and after are an "or" relationship, but may also indicate an "and/or" relationship, which can be understood with reference to the context.

本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In this application, "at least one" means one or more, and "plurality" means two or more. "At least one item(s) below" or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one item (a) of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple .

应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the embodiments of the present application. implementation constitutes any limitation.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, removable hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (31)

1.一种通信方法,其特征在于,应用于第一设备,所述第一设备包括传输控制协议TCP层和中间层,所述中间层为所述TCP层的下层,所述方法包括:1. a communication method, is characterized in that, is applied to first equipment, described first equipment comprises transmission control protocol TCP layer and middle layer, described middle layer is the lower layer of described TCP layer, and described method comprises: 所述中间层接收来自第二设备的第一报文;所述第一报文指示所述TCP层重传第一数据;the middle layer receives the first packet from the second device; the first packet instructs the TCP layer to retransmit the first data; 所述中间层向所述第二设备发送所述第一数据,并丢弃所述第一报文。The intermediate layer sends the first data to the second device, and discards the first packet. 2.根据权利要求1所述的方法,其特征在于,在所述中间层接收来自第二设备的第一报文之前,所述方法还包括:2. The method according to claim 1, wherein before the middle layer receives the first packet from the second device, the method further comprises: 所述中间层缓存来自所述TCP层,和/或,所述第二设备的报文。The intermediate layer buffers the packets from the TCP layer and/or the second device. 3.根据权利要求1或2所述的方法,其特征在于,所述中间层接收来自第二设备的第一报文,包括:3. The method according to claim 1 or 2, wherein the intermediate layer receives the first packet from the second device, comprising: 所述中间层确定所有来自所述第二设备的报文中确认号相同的多个确认报文;determining, by the intermediate layer, multiple confirmation messages with the same confirmation number in all messages from the second device; 所述中间层确定所述多个确认报文中的第n个确认报文为所述第一报文,n为大于或等于2的整数。The middle layer determines that the nth confirmation message in the plurality of confirmation messages is the first message, and n is an integer greater than or equal to 2. 4.根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:4. The method according to any one of claims 1-3, wherein the method further comprises: 所述中间层接收第二报文,所述第二报文包括第一窗口指示信息,所述第一窗口指示信息指示第一窗口的长度;receiving, by the middle layer, a second packet, where the second packet includes first window indication information, and the first window indication information indicates the length of the first window; 所述中间层发送第三报文,所述第三报文包括第二窗口指示信息,所述第二窗口指示信息指示第二窗口的长度,所述第二窗口的长度大于或等于所述第一窗口的长度。The middle layer sends a third packet, the third packet includes second window indication information, the second window indication information indicates the length of the second window, and the length of the second window is greater than or equal to the first window. The length of a window. 5.根据权利要求4所述的方法,其特征在于,所述第一窗口指示信息包括第一窗口缩放因子字段和第一窗口大小字段;所述第二窗口指示信息包括第二窗口缩放因子字段和第二窗口大小字段;5. The method according to claim 4, wherein the first window indication information comprises a first window scaling factor field and a first window size field; the second window indication information comprises a second window scaling factor field and the second window size field; 所述第二窗口的长度大于或等于所述第一窗口的长度,包括如下一项或多项:The length of the second window is greater than or equal to the length of the first window, including one or more of the following: 所述第二窗口缩放因子字段的值大于或等于所述第一窗口缩放因子字段的值;The value of the second window scaling factor field is greater than or equal to the value of the first window scaling factor field; 所述第二窗口大小字段的值大于或等于所述第一窗口大小字段的值。The value of the second window size field is greater than or equal to the value of the first window size field. 6.根据权利要求4或5所述的方法,其特征在于,所述第二窗口为所述第二设备的接收窗口;6. The method according to claim 4 or 5, wherein the second window is a receiving window of the second device; 所述中间层接收第二报文,包括:The middle layer receives the second packet, including: 所述中间层接收来自所述第二设备的所述第二报文;receiving, by the intermediate layer, the second packet from the second device; 所述中间层发送第三报文,包括:The middle layer sends a third packet, including: 所述中间层向所述TCP层发送所述第三报文,所述第二窗口指示信息用于确定所述第一设备的发送窗口。The middle layer sends the third packet to the TCP layer, and the second window indication information is used to determine the sending window of the first device. 7.根据权利要求6所述的方法,其特征在于,所述方法还包括:7. The method according to claim 6, wherein the method further comprises: 所述中间层依据所述第一窗口指示信息所指示的第一窗口的长度向所述第二设备发送数据报文。The middle layer sends a data packet to the second device according to the length of the first window indicated by the first window indication information. 8.根据权利要求4或5所述的方法,其特征在于,所述第二窗口为所述第一设备的接收窗口;8. The method according to claim 4 or 5, wherein the second window is a receiving window of the first device; 所述中间层接收第二报文,包括:The middle layer receives the second packet, including: 所述中间层接收来自所述TCP层的所述第二报文;the middle layer receives the second packet from the TCP layer; 所述中间层发送第三报文,包括:The middle layer sends a third packet, including: 所述中间层向所述第二设备发送所述第三报文,所述第二窗口指示信息用于确定所述第二设备的发送窗口。The middle layer sends the third packet to the second device, and the second window indication information is used to determine the sending window of the second device. 9.根据权利要求8所述的方法,其特征在于,所述方法还包括:9. The method according to claim 8, wherein the method further comprises: 所述中间层依据所述第一窗口指示信息所指示的第一窗口的长度向所述TCP层发送数据报文。The middle layer sends a data packet to the TCP layer according to the length of the first window indicated by the first window indication information. 10.根据权利要求4-9中任一项所述的方法,其特征在于,所述第二窗口指示信息由所述第二报文对应的业务确定。10 . The method according to claim 4 , wherein the second window indication information is determined by a service corresponding to the second packet. 11 . 11.根据权利要求1-10中任一项所述的方法,其特征在于,所述方法还包括:11. The method according to any one of claims 1-10, wherein the method further comprises: 所述中间层接收来自所述第二设备的第四报文;所述第四报文为确认报文;the middle layer receives a fourth message from the second device; the fourth message is an acknowledgement message; 所述中间层判断所述中间层已接收的所有确认报文中是否存在第五报文;所述第五报文的确认号与所述第四报文的确认号相同;The middle layer judges whether there is a fifth message in all the confirmation messages received by the middle layer; the confirmation number of the fifth message is the same as the confirmation number of the fourth message; 若所述中间层已接收的所有确认报文中不存在所述第五报文,则所述中间层向所述TCP层发送所述第四报文。If the fifth packet does not exist in all the confirmation packets received by the intermediate layer, the intermediate layer sends the fourth packet to the TCP layer. 12.根据权利要求1-11中任一项所述的方法,其特征在于,所述中间层位于所述TCP层与网际互连协议IP层之间。12. The method according to any one of claims 1-11, wherein the intermediate layer is located between the TCP layer and the Internet Protocol (IP) layer. 13.根据权利要求1-12中任一项所述的方法,其特征在于,所述方法还包括:13. The method according to any one of claims 1-12, wherein the method further comprises: 第一时间段内,收到不同确认号的第一报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,所述中间层向所述TCP层发送第一消息;所述第一消息用于指示所述TCP层降低发送速率。During the first period of time, the number of received first packets with different acknowledgment numbers exceeds the congestion threshold, and/or when the packet loss rate reaches the packet loss threshold, the middle layer sends the first message to the TCP layer; The first message is used to instruct the TCP layer to reduce the sending rate. 14.根据权利要求1-13中任一项所述的方法,其特征在于,所述第一报文携带选择确认SACK选项,所述SACK选项用于指示重传所述第一数据。14. The method according to any one of claims 1-13, wherein the first packet carries a selection acknowledgement SACK option, and the SACK option is used to indicate retransmission of the first data. 15.一种通信装置,其特征在于,处理模块和收发模块;所述处理模块包括所述通信装置的传输控制协议TCP层和中间层,所述中间层为所述TCP层的下层;其中,15. A communication device, characterized in that: a processing module and a transceiver module; the processing module comprises a transmission control protocol TCP layer and an intermediate layer of the communication device, and the intermediate layer is a lower layer of the TCP layer; wherein, 所述通信装置的中间层,用于利用所述收发模块接收来自第二设备的第一报文;所述第一报文指示所述TCP层重传第一数据;an intermediate layer of the communication device, configured to use the transceiver module to receive a first message from a second device; the first message instructs the TCP layer to retransmit the first data; 所述通信装置的中间层,还用于丢弃所述第一报文,并利用所述收发模块向所述第二设备发送所述第一数据。The middle layer of the communication apparatus is further configured to discard the first packet, and use the transceiver module to send the first data to the second device. 16.根据权利要求15所述的装置,其特征在于,所述通信装置的中间层,还用于缓存来自所述TCP层,和/或,所述第二设备的报文。The apparatus according to claim 15, wherein the middle layer of the communication apparatus is further configured to buffer packets from the TCP layer and/or the second device. 17.根据权利要求15或16所述的装置,其特征在于,所述通信装置的中间层,还用于确定所有来自所述第二设备的报文中确认号相同的多个确认报文;17. The device according to claim 15 or 16, wherein the middle layer of the communication device is further configured to determine a plurality of confirmation messages with the same confirmation number in all messages from the second device; 所述通信装置的中间层,还用于确定所述多个确认报文中的第n个确认报文为所述第一报文,n为大于或等于2的整数。The middle layer of the communication device is further configured to determine that the nth confirmation message in the plurality of confirmation messages is the first message, where n is an integer greater than or equal to 2. 18.根据权利要求15-17中任一项所述的装置,其特征在于,所述通信装置的中间层,还用于利用所述收发模块接收第二报文,所述第二报文包括第一窗口指示信息,所述第一窗口指示信息指示第一窗口的长度;18. The device according to any one of claims 15-17, wherein the middle layer of the communication device is further configured to use the transceiver module to receive a second packet, wherein the second packet includes first window indication information, where the first window indication information indicates the length of the first window; 所述通信装置的中间层,还用于利用所述收发模块发送第三报文,所述第三报文包括第二窗口指示信息,所述第二窗口指示信息指示第二窗口的长度,所述第二窗口的长度大于或等于所述第一窗口的长度。The middle layer of the communication device is further configured to use the transceiver module to send a third message, where the third message includes second window indication information, and the second window indication information indicates the length of the second window, so The length of the second window is greater than or equal to the length of the first window. 19.根据权利要求18所述的装置,其特征在于,所述第一窗口指示信息包括第一窗口缩放因子和第一窗口大小;所述第二窗口指示信息包括第二窗口缩放因子和第二窗口大小;19. The apparatus according to claim 18, wherein the first window indication information comprises a first window scaling factor and a first window size; the second window indication information comprises a second window scaling factor and a second window scaling factor window size; 所述第二窗口的长度大于或等于所述第一窗口的长度,包括如下一项或多项:The length of the second window is greater than or equal to the length of the first window, including one or more of the following: 所述第二窗口缩放因子大于或等于所述第一窗口缩放因子;the second window scaling factor is greater than or equal to the first window scaling factor; 所述第二窗口大小大于或等于所述第一窗口大小。The second window size is greater than or equal to the first window size. 20.根据权利要求18或19所述的装置,其特征在于,所述第二窗口为所述第二设备的接收窗口;20. The apparatus according to claim 18 or 19, wherein the second window is a receiving window of the second device; 所述通信装置的中间层,还用于利用所述收发模块接收来自所述第二设备的所述第二报文;The middle layer of the communication device is further configured to use the transceiver module to receive the second message from the second device; 所述通信装置的中间层,还用于利用所述收发模块向所述TCP层发送所述第三报文,所述第二窗口指示信息用于确定所述通信装置的发送窗口。The middle layer of the communication device is further configured to use the transceiver module to send the third packet to the TCP layer, and the second window indication information is used to determine a sending window of the communication device. 21.根据权利要求20所述的装置,其特征在于,所述通信装置的中间层,还用于依据所述第一窗口指示信息所指示的第一窗口的长度向所述第二设备发送数据报文。21. The apparatus according to claim 20, wherein the middle layer of the communication apparatus is further configured to send data to the second device according to the length of the first window indicated by the first window indication information message. 22.根据权利要求18或19所述的装置,其特征在于,所述第二窗口为所述通信装置的接收窗口;22. The device according to claim 18 or 19, wherein the second window is a receiving window of the communication device; 所述通信装置的中间层,还用于利用所述收发模块接收来自所述TCP层的所述第二报文;The middle layer of the communication device is further configured to receive the second message from the TCP layer by using the transceiver module; 所述通信装置的中间层,还用于利用所述收发模块向所述第二设备发送所述第三报文,所述第二窗口指示信息用于确定所述第二设备的发送窗口。The middle layer of the communication apparatus is further configured to use the transceiver module to send the third packet to the second device, and the second window indication information is used to determine a sending window of the second device. 23.根据权利要求22所述的装置,其特征在于,所述通信装置的中间层,还用于依据所述第一窗口指示信息所指示的第一窗口的长度向所述TCP层发送数据报文。23. The device according to claim 22, wherein the middle layer of the communication device is further configured to send a datagram to the TCP layer according to the length of the first window indicated by the first window indication information arts. 24.根据权利要求18-23中任一项所述的装置,其特征在于,所述第二窗口指示信息由所述第二报文对应的业务确定。24. The apparatus according to any one of claims 18-23, wherein the second window indication information is determined by a service corresponding to the second packet. 25.根据权利要求15-24中任一项所述的装置,其特征在于,所述通信装置的中间层,还用于利用所述收发模块接收来自所述第二设备的第四报文;所述第四报文为确认报文;25. The device according to any one of claims 15-24, wherein the middle layer of the communication device is further configured to use the transceiver module to receive a fourth message from the second device; The fourth message is a confirmation message; 所述通信装置的中间层,还用于判断所述中间层已接收的所有确认报文中是否存在第五报文;所述第五报文的确认号与所述第四报文的确认号相同;The middle layer of the communication device is further configured to judge whether there is a fifth message in all the confirmation messages received by the middle layer; the confirmation number of the fifth message and the confirmation number of the fourth message same; 所述通信装置的中间层,还用于若所述中间层已接收的所有确认报文中不存在所述第五报文,则利用所述收发模块向所述TCP层发送所述第四报文。The middle layer of the communication device is further configured to send the fourth message to the TCP layer by using the transceiver module if the fifth message does not exist in all the confirmation messages received by the middle layer arts. 26.根据权利要求15-25中任一项所述的装置,其特征在于,所述中间层位于所述TCP层与网际互连协议IP层之间。26. The apparatus according to any one of claims 15-25, wherein the intermediate layer is located between the TCP layer and the Internet Protocol (IP) layer. 27.根据权利要求15-26中任一项所述的装置,其特征在于,所述通信装置的中间层,还用于在第一时间段内收到不同确认号的第一报文的数量超过拥塞阈值,和/或,丢包率达到丢包阈值时,利用所述收发模块向所述TCP层发送第一消息;所述第一消息用于指示所述TCP层降低发送速率。27. The device according to any one of claims 15-26, wherein the middle layer of the communication device is further configured to receive the number of first packets with different acknowledgment numbers in the first time period When the congestion threshold is exceeded, and/or the packet loss rate reaches the packet loss threshold, the transceiver module is used to send a first message to the TCP layer; the first message is used to instruct the TCP layer to reduce the sending rate. 28.根据权利要求15-27中任一项所述的装置,其特征在于,所述第一报文携带选择确认SACK选项,所述SACK选项用于指示重传所述第一数据。28. The apparatus according to any one of claims 15-27, wherein the first packet carries a selection acknowledgment SACK option, and the SACK option is used to indicate retransmission of the first data. 29.一种通信装置,其特征在于,包括:处理器,所述处理器与存储器耦合;29. A communication device, comprising: a processor coupled to a memory; 所述处理器,用于执行所述存储器中存储的计算机程序,以使得所述通信装置执行如权利要求1-14中任一项所述的通信方法。The processor is configured to execute the computer program stored in the memory, so that the communication apparatus executes the communication method according to any one of claims 1-14. 30.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行如权利要求1-14中任一项所述的通信方法。30. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a computer program or instruction, which, when the computer program or instruction is executed on a computer, causes the computer to perform the method according to claim 1- The communication method of any one of 14. 31.一种计算机程序产品,其特征在于,所述计算机程序产品包括:计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行如权利要求1-14中任一项所述的通信方法。31. A computer program product, characterized in that the computer program product comprises: a computer program or instruction that, when the computer program or instruction is run on a computer, causes the computer to perform any one of claims 1-14. A method of communication as described.
CN202110315648.8A 2021-03-24 2021-03-24 Communication method and device Pending CN115134049A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110315648.8A CN115134049A (en) 2021-03-24 2021-03-24 Communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110315648.8A CN115134049A (en) 2021-03-24 2021-03-24 Communication method and device

Publications (1)

Publication Number Publication Date
CN115134049A true CN115134049A (en) 2022-09-30

Family

ID=83373922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110315648.8A Pending CN115134049A (en) 2021-03-24 2021-03-24 Communication method and device

Country Status (1)

Country Link
CN (1) CN115134049A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100257423A1 (en) * 2007-10-16 2010-10-07 Jin Ju Kim Method of performing arq procedure for transmitting high rate data
CN102143078A (en) * 2011-03-29 2011-08-03 华为技术有限公司 Forwarding equipment as well as method and system for processing message
CN106034014A (en) * 2015-03-19 2016-10-19 中兴通讯股份有限公司 Method for requesting packet loss retransmission, receiving apparatus and sending apparatus
CN108023758A (en) * 2016-11-04 2018-05-11 华为技术有限公司 The method and the network equipment of message are handled in a kind of mixed insertion network
WO2019137501A1 (en) * 2018-01-12 2019-07-18 华为技术有限公司 Communication method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100257423A1 (en) * 2007-10-16 2010-10-07 Jin Ju Kim Method of performing arq procedure for transmitting high rate data
CN102143078A (en) * 2011-03-29 2011-08-03 华为技术有限公司 Forwarding equipment as well as method and system for processing message
CN106034014A (en) * 2015-03-19 2016-10-19 中兴通讯股份有限公司 Method for requesting packet loss retransmission, receiving apparatus and sending apparatus
CN108023758A (en) * 2016-11-04 2018-05-11 华为技术有限公司 The method and the network equipment of message are handled in a kind of mixed insertion network
WO2019137501A1 (en) * 2018-01-12 2019-07-18 华为技术有限公司 Communication method and device

Similar Documents

Publication Publication Date Title
US11997153B2 (en) Screen projection method and device
CN115334138B (en) QUIC data transmission method, device, client and server
CN114979839B (en) A transmission control protocol proxy method and communication device
WO2022228015A1 (en) Data transmission method, and device
WO2022188813A1 (en) Bluetooth communication method and system, and electronic device
WO2023011380A1 (en) Multi-frame fusion transmission method in beidou communication system, and related apparatus
WO2023011329A1 (en) Data transmission control method and system in beidou communication system, and related apparatus
WO2023011362A1 (en) Control method and system for outbound transport in beidou communication system, and related apparatus
CN116828635A (en) Business processing methods and devices
US20220263607A1 (en) Method and device for data storage
CN118353880A (en) Voice communication method, device, equipment and computer storage medium
CN115694596B (en) Inbound transmission control method, system and related device in Beidou communication system
CN115841825A (en) Voice transmission method, readable medium and electronic device
EP4354917A1 (en) Data processing method and electronic device
CN115134049A (en) Communication method and device
WO2021087688A1 (en) Data transmission method and apparatus, and storage medium
WO2021244160A1 (en) Communication method and apparatus
CN114640725B (en) Data transmission method and electronic device
EP4387138A1 (en) Video transmission method and electronic device
CN117201471A (en) Data transmission method using WebSocket protocol and related equipment thereof
CN117939406A (en) Multicast communication method and related device
WO2024067430A1 (en) Transmission method and system, and related apparatus
WO2024027674A1 (en) Communication method and device, and storage medium
WO2021092729A1 (en) Method and apparatus for transmitting hybrid automatic repeat request feedback, and communication device
WO2024000959A1 (en) Data transmission method, electronic device, and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination