[go: up one dir, main page]

CN114599089A - A data communication method and related device - Google Patents

A data communication method and related device Download PDF

Info

Publication number
CN114599089A
CN114599089A CN202210254784.5A CN202210254784A CN114599089A CN 114599089 A CN114599089 A CN 114599089A CN 202210254784 A CN202210254784 A CN 202210254784A CN 114599089 A CN114599089 A CN 114599089A
Authority
CN
China
Prior art keywords
length
message
server
packet
client
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
CN202210254784.5A
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.)
Fibocom Wireless Inc
Original Assignee
Fibocom Wireless Inc
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 Fibocom Wireless Inc filed Critical Fibocom Wireless Inc
Priority to CN202210254784.5A priority Critical patent/CN114599089A/en
Publication of CN114599089A publication Critical patent/CN114599089A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/30Resource management for broadcast services
    • 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/36Flow control; Congestion control by determining packet size, e.g. maximum transfer unit [MTU]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/20Control channels or signalling for resource management
    • H04W72/23Control channels or signalling for resource management in the downlink direction of a wireless link, i.e. towards a terminal
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

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

Abstract

The application provides a data communication method and a related device, which are applied to a client, wherein the client is in wireless connection with a server through a base station, and the method comprises the following steps: acquiring a first message length sent by a base station, and determining the smaller message length in the first message length and the second message length as a third message length; the first message length is the maximum data length determined by the operator network, and the second message length is the maximum data length of a message segment expected to be received by the client; acquiring a fourth message length sent by the server, and determining a target message length according to the smaller message length in the third message length and the fourth message length; the fourth message length is the maximum data length of the message segment expected to be received by the server; and sending the first message segment to the server side through the base station, wherein the length of the first message segment is determined based on the length of the target message. The method and the device can reduce the possibility of fragment transmission of the TCP data packet during transmission in the operator network and improve the utilization rate of network resources.

Description

一种数据通信方法及相关装置A data communication method and related device

技术领域technical field

本申请涉及计算机领域,尤其涉及一种数据通信方法及相关装置。The present application relates to the field of computers, and in particular, to a data communication method and related apparatus.

背景技术Background technique

随着信息技术的发展,移动通信技术为人们的工作和生活带来了不少的便利,成为了人们工作和生活不可或缺的重要部分。With the development of information technology, mobile communication technology has brought a lot of convenience to people's work and life, and has become an indispensable part of people's work and life.

一般地,两个电子设备之间可以通过传输控制协议(Transmission ControlProtocol,TCP)进行可靠的移动通信,在进行移动通信之前,两个电子设备通过TCP三次握手建立可靠连接。在TCP三次握手流程中两个电子设备会把己方所在链路的最大报文长度(Maximum Segment Size,MSS)的值通知给对方,两个电子设备一般就会将两个MSS中的较小值作为己方发送的TCP数据包的发送长度。Generally, reliable mobile communication can be performed between two electronic devices through a transmission control protocol (Transmission Control Protocol, TCP). Before performing mobile communication, the two electronic devices establish a reliable connection through TCP three-way handshake. In the TCP three-way handshake process, two electronic devices will notify each other of the value of the maximum message length (Maximum Segment Size, MSS) of their own link, and the two electronic devices will generally report the smaller value of the two MSSs. The sending length of the TCP packet sent as the own side.

这种方法满足了两个电子设备对接收长度的要求,但两个电子设备之间的通信还需要运营商网络等设备的参与。当运营商网络搭建的TCP协议与电子设备搭建的TCP协议不一致时,就会存在运营商网络链路的MSS比电子设备所在链路的MSS的值要小的问题,这就造成了TCP数据包在运营商网络中的传输需要分片传输,大量数据包的分片和重组,造成网络资源利用率低的问题。This method satisfies the requirements of the two electronic devices on the receiving length, but the communication between the two electronic devices also requires the participation of devices such as the operator's network. When the TCP protocol established by the operator's network is inconsistent with the TCP protocol established by the electronic device, there will be a problem that the MSS of the operator's network link is smaller than the value of the MSS of the link where the electronic device is located, which results in TCP data packets. Transmission in the operator network requires fragmented transmission, fragmentation and reassembly of a large number of data packets, resulting in the problem of low utilization of network resources.

发明内容SUMMARY OF THE INVENTION

基于此,有必要针对上述技术问题,提供一种数据通信方法及相关装置,以实现减小TCP数据包在运营商网络中的传输时进行分片传输的可能,提高网络资源利用率。Based on this, it is necessary to provide a data communication method and related device in view of the above technical problems, so as to reduce the possibility of fragmented transmission of TCP data packets during transmission in the operator's network, and improve the utilization rate of network resources.

第一方面,本发明提供一种数据通信方法,应用于客户端,所述客户端通过基站与服务端无线连接,所述方法包括:获取所述基站发送的第一报文长度,并确定所述第一报文长度和第二报文长度中较小的报文长度为第三报文长度;其中,所述第一报文长度为运营商网络确定的最大数据长度,所述第二报文长度为所述客户端期望接收到的报文段的最大数据长度;通过传输控制协议/网络互联协议TCP/IP协议栈获取所述服务端发送的第四报文长度,并根据所述第三报文长度和所述第四报文长度中较小的报文长度确定目标报文长度;其中,所述第四报文长度为所述服务端期望接收到的报文段的最大数据长度;通过所述基站向所述服务端发送第一报文段,所述第一报文段的长度基于所述目标报文长度确定。In a first aspect, the present invention provides a data communication method, which is applied to a client. The client is wirelessly connected to a server through a base station. The method includes: acquiring the length of a first packet sent by the base station, and determining The smaller of the first packet length and the second packet length is the third packet length; wherein, the first packet length is the maximum data length determined by the operator network, and the second packet length is the maximum data length determined by the operator network. The length of the message is the maximum data length of the message segment that the client expects to receive; the fourth message length sent by the server is obtained through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and according to the The smaller of the three packet lengths and the fourth packet length determines the target packet length; wherein the fourth packet length is the maximum data length of the packet segment that the server expects to receive ; Send a first message segment to the server through the base station, and the length of the first message segment is determined based on the length of the target message.

由此,客户端与服务端根据上述目标报文长度进行数据通信,若上述第一报文长度小于上述第三报文长度,则上述目标报文长度即为该第一报文长度,从而客户端与服务端的数据通信中当数据传输到运营商网络(基站或核心网)后,运营商网络不会再对数据进行分片处理,数据到达服务端后也不需要进行重组处理,从而可以提高网络资源利用率、节省CPU处理资源和网络宽带资源,避免网络拥塞,同时也可以提高数据传输效率。Therefore, the client and the server perform data communication according to the length of the target message. If the length of the first message is less than the length of the third message, the length of the target message is the length of the first message, so that the client In the data communication between the client and the server, after the data is transmitted to the operator's network (base station or core network), the operator's network will no longer fragment the data, and the data does not need to be reorganized after reaching the server. Network resource utilization, saving CPU processing resources and network bandwidth resources, avoiding network congestion, and improving data transmission efficiency.

在一种可能的实现方式中,所述客户端包括主机和无线通信模组,所述TCP/IP协议栈配置于所述无线通信模组,所述通过传输控制协议/网络互联协议TCP/IP协议栈获取所述服务端发送的第四报文长度,并根据所述第三报文长度和所述第四报文长度中较小的报文长度确定目标报文长度,包括:所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述第三报文长度;所述无线通信模组通过所述TCP/IP协议栈接收所述服务端发送的所述第四报文长度;所述无线通信模组确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度。In a possible implementation manner, the client includes a host and a wireless communication module, the TCP/IP protocol stack is configured on the wireless communication module, and the TCP/IP protocol stack is configured through the transmission control protocol/internet protocol. The protocol stack obtains the fourth packet length sent by the server, and determines the target packet length according to the smaller packet length of the third packet length and the fourth packet length, including: the wireless The communication module sends the third message length to the server through the TCP/IP protocol stack; the wireless communication module receives the fourth message sent by the server through the TCP/IP protocol stack. packet length; the wireless communication module determines that the smaller packet length of the third packet length and the fourth packet length is the target packet length.

可理解的,为完成TCP三次握手协议,以确保客户端和服务端之间的通信为可靠通信,客户端会在与服务端进行正常通信之前,向服务端发送ACK应答报文。也即,在一种可能的实现方式中,在所述无线通信模组确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度之后,所述通过所述基站向所述服务端发送第一报文段之前,所述方法还包括:所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述目标报文长度,以使得所述客户端和所述服务端基于所述目标报文长度进行数据通信。Understandably, in order to complete the TCP three-way handshake protocol and ensure reliable communication between the client and the server, the client sends an ACK response message to the server before normal communication with the server. That is, in a possible implementation manner, after the wireless communication module determines that the smaller one of the third packet length and the fourth packet length is the target packet length , before the sending the first message segment to the server through the base station, the method further includes: the wireless communication module sends the target message to the server through the TCP/IP protocol stack message length, so that the client and the server perform data communication based on the target message length.

可理解的,若TCP/IP协议栈配置在无线通信模组中(也可以理解为此时客户端与服务端即将进行内置业务),无线通信模组有权限控制TCP/IP协议栈三次握手时的握手数据。从而若TCP/IP协议栈配置在无线通信模组中,无线通信模组可以在进行TCP三次握手中的第一握手时就以第一报文长度和第二报文长度中的较小值(第三报文长度)进行TCP三次握手。Understandably, if the TCP/IP protocol stack is configured in the wireless communication module (it can also be understood that the client and the server are about to carry out built-in services), the wireless communication module has the authority to control the TCP/IP protocol stack when the three-way handshake is performed. handshake data. Therefore, if the TCP/IP protocol stack is configured in the wireless communication module, the wireless communication module can use the smaller value of the first packet length and the second packet length ( The third packet length) performs the TCP three-way handshake.

可理解的,在第一次握手时就以第一报文长度和第二报文长度中的较小值(第三报文长度)进行握手动作,而不是在第二次握手后根据第四报文长度和第三报文长度的值修改服务端发送的数据,可以为数据同步提供更好的保障。示例性的,在第一次握手时就以第第三报文长度进行握手动作,无论服务端是否执行本申请提供的数据通信方法,服务端在TCP三从握手中也间接性地根据第一报文长度、第二报文长度和第三报文长度中的较小值确定通信的报文长度。例如客户端和服务端均在同一个运营商网络的同一个核心网中驻网,且该核心网对于客户端和服务端期望接收到的数据的报文段的报文长度一致、以及仅由客户端执行本申请的数据通信方法的情况下,由于服务端无法知晓客户端是否已修改第二次握手时的数据内容,而导致服务端还是会按照得到的第二报文长度和第三报文长度确定目标报文长度,而不是根据第一报文长度、第二报文长度和第三报文长度中的较小值确定通信的报文长度,最终导致服务端向客户端发送的数据经由核心网时,还是会被分片传输。Understandably, during the first handshake, the handshake action is performed with the smaller of the first packet length and the second packet length (the third packet length), rather than the fourth one after the second handshake. The values of the packet length and the third packet length modify the data sent by the server, which can provide better guarantee for data synchronization. Exemplarily, the handshake action is performed with the third packet length during the first handshake, regardless of whether the server implements the data communication method provided by this application, the server also indirectly performs the handshake according to the first three-slave handshake in the TCP. The smaller value of the message length, the second message length, and the third message length determines the message length of the communication. For example, both the client and the server reside on the same core network of the same operator network, and the core network has the same message length for the segment of the data expected to be received by the client and the server, and only consists of When the client implements the data communication method of the present application, since the server cannot know whether the client has modified the data content of the second handshake, the server will still follow the obtained second packet length and third packet length. The length of the message determines the length of the target message, instead of determining the length of the communication message based on the smaller of the first message length, the second message length and the third message length, which eventually leads to the data sent by the server to the client. When passing through the core network, it will still be transmitted in fragments.

由此,在第一次握手时就以第一报文长度和第二报文长度中的较小值(第三报文长度)进行握手动作,可以进一步提高网络资源利用率、节省CPU处理资源和网络宽带资源,避免网络拥塞,同时也可以提高客户端或服务端的无线通信模组的数据传输效率。Therefore, during the first handshake, the handshake action is performed with the smaller value of the first packet length and the second packet length (the third packet length), which can further improve network resource utilization and save CPU processing resources. and network broadband resources to avoid network congestion, and at the same time, it can also improve the data transmission efficiency of the wireless communication module of the client or server.

在一种可能的实现方式中,所述客户端包括主机和无线通信模组,所述TCP/IP协议栈配置于所述主机,所述通过传输控制协议/网络互联协议TCP/IP协议栈获取所述服务端发送的第四报文长度,并根据所述第三报文长度和所述第四报文长度中较小的报文长度确定目标报文长度,包括:所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述第二报文长度;所述无线通信模组接收服务端发送的所述第四报文长度,并与所述第三报文长度比较,确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,所述无线通信模组将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机。In a possible implementation manner, the client includes a host and a wireless communication module, the TCP/IP protocol stack is configured on the host, and the TCP/IP protocol stack is obtained through the Transmission Control Protocol/Internet Protocol The fourth packet length sent by the server, and determining the target packet length according to the smaller packet length of the third packet length and the fourth packet length, including: the host based on the The TCP/IP protocol stack sends the second packet length to the server through the wireless communication module; the wireless communication module receives the fourth packet length sent by the server, and communicates with the first packet length. Three packet lengths are compared, and it is determined that the smaller of the third packet length and the fourth packet length is the target packet length; after determining the fourth packet length and the target packet length If the lengths are not equal, the wireless communication module modifies the length of the fourth message to the length of the target message, and sends it to the host.

可理解的,为完成TCP三次握手协议,在所述将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机之后,所述通过所述基站向所述服务端发送第一报文段之前,所述方法还包括:所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述目标报文长度,以使得所述客户端和所述服务端基于所述目标报文长度进行数据通信。Understandably, in order to complete the TCP three-way handshake protocol, after the length of the fourth packet is tampered with the length of the target packet and sent to the host, the base station sends the information to the server through the base station. Before sending the first message segment, the method further includes: the host sends the target message length to the server through the wireless communication module based on the TCP/IP protocol stack, so that the client The terminal and the server perform data communication based on the target packet length.

若TCP/IP协议栈未配置在无线通信模组中(也可以理解为此时客户端与服务端即将进行外置业务),无线通信模组没有权限控制主机中的TCP/IP协议栈发送的握手数据,但是无线通信模组有权限操作从服务端接收到的握手数据。从而若TCP/IP协议栈未配置在无线通信模组中的情况下,无线通信模组可以在进行TCP三次握手中的第二次握手时,在接收到服务端发送的第三报文长度后,确定该第四报文长度是否大于第三报文长度,若是,则将该第三报文长度确定为上述目标报文长度,并将接收到的第四报文长度修改为第三报文长度上报给主机。If the TCP/IP protocol stack is not configured in the wireless communication module (it can also be understood that the client and the server are about to perform external services at this time), the wireless communication module does not have the right to control the TCP/IP protocol stack in the host. Handshake data, but the wireless communication module has permission to operate the handshake data received from the server. Therefore, if the TCP/IP protocol stack is not configured in the wireless communication module, the wireless communication module can perform the second handshake in the TCP three-way handshake, after receiving the third message length sent by the server. , determine whether the length of the fourth packet is greater than the length of the third packet, and if so, determine the length of the third packet as the above-mentioned target packet length, and modify the length of the fourth packet received to the third packet The length is reported to the host.

可理解的,在一个客户端中不会同时支持上述内置业务和上述外置业务,一个客户端中要么支持内置业务要么支持外置业务。从而程序设计者可以根据客户端支持的业务类型确定在客户端中配置上述“所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述第三报文长度;所述无线通信模组通过所述TCP/IP协议栈接收所述服务端发送的所述第四报文长度;所述无线通信模组确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度”的方案逻辑,还是配置上述“所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述第二报文长度;所述无线通信模组接收服务端发送的所述第四报文长度,并与所述第三报文长度比较,确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,所述无线通信模组将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机”的方案逻辑。Understandably, the above built-in service and the above-mentioned external service are not supported simultaneously in one client, and one client supports either the built-in service or the external service. Thereby, the programmer can determine to configure the above-mentioned "the wireless communication module sends the third message length to the server through the TCP/IP protocol stack in the client according to the business type supported by the client; the The wireless communication module receives the fourth message length sent by the server through the TCP/IP protocol stack; the wireless communication module determines the length of the third message and the length of the fourth message. The solution logic of the smaller message length is the target message length", or configure the above "the host sends the second message to the server through the wireless communication module based on the TCP/IP protocol stack. The length of the message; the wireless communication module receives the length of the fourth message sent by the server, and compares it with the length of the third message to determine the length of the third message and the length of the fourth message The smaller value is the target message length; when it is determined that the fourth message length is not equal to the target message length, the wireless communication module tampers with the fourth message length into the target message length, and send it to the host" scheme logic.

本申请实施例提供的数据通信方法,可以适用于内置业务也可以适用于外置业务,适应性强。The data communication method provided by the embodiments of the present application can be applied to built-in services or external services, and has strong adaptability.

在一种可能的实现方式中,所述获取所述基站发送的第一报文长度,包括:获取所述基站发送的第一最大传输单元MTU,按照公式“第一报文长度=第一最大传输单元MTU-IP首部长度-TCP首部长度”计算所述第一报文长度;其中所述第一最大传输单元MTU由所述运营商网络确定,所述IP首部长度和所述TCP首部长度分别为与所述客户端中配置的网络协议版本对应的IP首部长度和TCP首部长度。In a possible implementation manner, the obtaining the length of the first message sent by the base station includes: obtaining the first maximum transmission unit MTU sent by the base station, according to the formula "first message length=first maximum transmission unit" Transmission unit MTU-IP header length-TCP header length" to calculate the first message length; wherein the first maximum transmission unit MTU is determined by the operator network, and the IP header length and the TCP header length are respectively is the length of the IP header and the length of the TCP header corresponding to the network protocol version configured in the client.

在一种可能的实现方式中,所述获取所述基站发送的第一最大传输单元MTU,包括:在所述客户端驻网时,接收所述基站发送的分组数据网PDN数据包,所述PDN数据包中包括所述第一MTU。In a possible implementation manner, the obtaining the first maximum transmission unit MTU sent by the base station includes: when the client resides on the network, receiving a packet data network PDN data packet sent by the base station, the The first MTU is included in the PDN data packet.

第二方面,本申请提供一种数据通信装置,包括:第一确定单元,用于获取所述基站发送的第一报文长度,并确定所述第一报文长度和第二报文长度中较小的报文长度为第三报文长度;其中,所述第一报文长度为运营商网络确定的最大数据长度,所述第二报文长度为所述客户端期望接收到的最大数据长度;第二确定单元,用于通过传输控制协议/网络互联协议TCP/IP协议栈获取所述服务端发送的第四报文长度,并根据所述第三报文长度和所述第四报文长度中较小的报文长度确定目标报文长度;其中,所述第四报文长度为所述服务端期望接收到的报文段的最大数据长度;收发单元,用于通过所述基站向所述服务端发送第一报文段,所述第一报文段的长度基于所述目标报文长度确定。In a second aspect, the present application provides a data communication device, comprising: a first determination unit, configured to acquire the length of a first packet sent by the base station, and determine the length of the first packet and the length of the second packet The smaller packet length is the third packet length; wherein the first packet length is the maximum data length determined by the operator network, and the second packet length is the maximum data the client expects to receive length; a second determination unit, configured to obtain the fourth message length sent by the server through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and according to the third message length and the fourth message length The smaller message length among the message lengths determines the target message length; wherein, the fourth message length is the maximum data length of the message segment that the server expects to receive; the transceiver unit is used to pass the base station Send a first message segment to the server, where the length of the first message segment is determined based on the length of the target message.

第三方面,本申请提供一种电子设备,包括:存储器、处理器,其中,该存储器存储有程序指令;该程序指令被该处理器执行时,使该处理器执行如第一方面以及第一方面中任一可能的实现方式描述的方法。In a third aspect, the present application provides an electronic device, comprising: a memory and a processor, wherein the memory stores program instructions; when the program instructions are executed by the processor, the processor is made to execute the first aspect and the first A method described in any possible implementation of the aspect.

第四方面,本申请实施例提供一种芯片系统,该芯片系统应用于电子设备,该芯片系统包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行该第一方面或第一方面的任意可能的实现方式所示的方法。In a fourth aspect, an embodiment of the present application provides a chip system, the chip system is applied to an electronic device, the chip system includes one or more processors, and the processors are configured to invoke computer instructions to cause the electronic device to perform the first aspect or the method shown in any possible implementation manner of the first aspect.

第五方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序;当该计算机程序在一个或多个处理器上运行时,使得该电子设备设备执行如第一方面以及第一方面中任一可能的实现方式描述的方法。In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored; when the computer program is run on one or more processors, the electronic device is made to execute the The method described in one aspect and any possible implementation of the first aspect.

第六方面,本申请提供一种包含指令的计算机程序产品,当该计算机程序产品在电子设备设备上运行时,使得该电子设备设备执行如第一方面以及第一方面中任一可能的实现方式描述的方法。In a sixth aspect, the present application provides a computer program product comprising instructions, when the computer program product is run on an electronic device, the electronic device is made to perform the first aspect and any possible implementation manner of the first aspect method described.

可以理解的,上述第二方面提供的数据通信装置、第三方面提供的电子设备、第四方面提供的芯片系统、第五方面提供的计算机存储介质和第六方面提供的计算机程序产品均用于执行本申请实施例第一方面或第一方面的任一实现方式所示的方法。因此,其所能达到的有益效果可参考对应方法中的有益效果,此处不再赘述。It can be understood that the data communication device provided in the second aspect, the electronic device provided in the third aspect, the chip system provided in the fourth aspect, the computer storage medium provided in the fifth aspect, and the computer program product provided in the sixth aspect are all used for Execute the method shown in the first aspect or any implementation manner of the first aspect in the embodiments of the present application. Therefore, for the beneficial effects that can be achieved, reference may be made to the beneficial effects in the corresponding method, which will not be repeated here.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍。In order to describe the technical solutions in the embodiments of the present invention more clearly, the accompanying drawings required in the embodiments will be briefly introduced below.

图1为本申请实施例提供的最大传输单元体现在数据帧中的长度的示意图;1 is a schematic diagram of the length of a maximum transmission unit embodied in a data frame provided by an embodiment of the present application;

图2为本申请实施例提供的最大报文长度体现在数据帧中的长度的示意图;2 is a schematic diagram of the length of the maximum message length embodied in a data frame provided by an embodiment of the present application;

图3为本申请实施例提供的一种数据通信方法的流程示意图;3 is a schematic flowchart of a data communication method provided by an embodiment of the present application;

图4A为本申请实施例提供的一种客户端和服务端之间的通信装置示意图;4A is a schematic diagram of a communication device between a client and a server according to an embodiment of the present application;

图4B为本申请实施例提供的又一种数据通信方法的流程示意图;4B is a schematic flowchart of another data communication method provided by an embodiment of the present application;

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

图6为本申请实施例提供的又一种数据通信方法的流程示意图;6 is a schematic flowchart of another data communication method provided by an embodiment of the present application;

图7为本申请实施例提供的一种数据通信装置的结构示意图;FIG. 7 is a schematic structural diagram of a data communication device according to an embodiment of the present application;

图8为本申请实施例提供的又一种数据通信装置的结构示意图。FIG. 8 is a schematic structural diagram of still another data communication apparatus provided by an embodiment of the present application.

具体实施方式Detailed ways

下面结合附图对本申请作进一步详细描述。The present application will be described in further detail below with reference to the accompanying drawings.

本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations of the present application. As used in the specification of this application and the appended claims, the singular expressions "a," "an," "the," "above," "the," and "the" are intended to also Plural expressions are included unless the context clearly dictates otherwise.

在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上,“至少两个(项)”是指两个或三个及三个以上,“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”。In this application, "at least one (item)" means one or more, "plurality" means two or more, "at least two (item)" means two or three and three In the above, "and/or" is used to describe the relationship of related objects, indicating that there can be three kinds of relationships, for example, "A and/or B" can mean: only A exists, only B exists, and both A and B exist three A case where A and B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one of the following" or similar expressions, refers to any combination of these items. For example, at least one (a) of a, b or c, can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ".

本申请实施例提供了一种数据通信方法,为了更清楚地描述本申请的方案,下面先介绍一些与本方案数据通信相关的知识。The embodiment of the present application provides a data communication method. In order to describe the solution of the present application more clearly, some knowledge related to the data communication of the solution is introduced below.

1、无线通信模组1. Wireless communication module

在本申请实施例中,无线通信模组即为移动通信模组。该移动通信模组可以理解为蜂窝通信模组,是指实现移动通信功能的软件和硬件的功能模块。例如该移动通信模组可以是实现2G、3G、4G或5G蜂窝移动通信技术的功能模块。具体的,该移动通信模组可以是一种将基带芯片、射频芯片、存储器、功放器件、天线接口以及功能接口等集成于电路板上的模块化组件,可以实现无线电波收发、信道噪声过滤及模拟信号与数字信号之间相互转换等功能。In the embodiments of the present application, the wireless communication module is a mobile communication module. The mobile communication module can be understood as a cellular communication module, which refers to a functional module of software and hardware for realizing mobile communication functions. For example, the mobile communication module may be a functional module implementing 2G, 3G, 4G or 5G cellular mobile communication technology. Specifically, the mobile communication module can be a modular component that integrates a baseband chip, a radio frequency chip, a memory, a power amplifier device, an antenna interface, and a functional interface on a circuit board, which can realize radio wave transmission and reception, channel noise filtering and other functions. Functions such as mutual conversion between analog signals and digital signals.

移动通信模组的功能可以承载客户端到服务端(也可以理解为一个终端设备到另外一个终端设备)之间的数据交互。The function of the mobile communication module can carry the data interaction between the client and the server (which can also be understood as one terminal device to another terminal device).

2、MTU、MSS2. MTU, MSS

最大传输单元(Maxitum Transmission Unit,MTU)用于表示网络层数据的最大长度;示例性的,如图1所示,该MTU包括数据帧中的IP首部的长度、TCP首部的长度以及IP数据的长度,该IP数据的长度也可以理解为数据帧中报文段的长度或数据帧中负载的数据长度。可理解的,上述数据帧中还可以包括除IP数据、TCP首部、以及IP首部之外的其他字段,本文对此不做限定,例如该第一数据帧中还可以包括以太网首部、帧检验序列(framecheck sequence,FCS)字段The maximum transmission unit (Maxitum Transmission Unit, MTU) is used to represent the maximum length of network layer data; exemplarily, as shown in Figure 1, the MTU includes the length of the IP header, the length of the TCP header and the length of the IP data in the data frame. The length of the IP data can also be understood as the length of the message segment in the data frame or the length of the data carried in the data frame. Understandably, the above-mentioned data frame may also include other fields except IP data, TCP header, and IP header, which are not limited herein, for example, the first data frame may also include Ethernet header, frame check. Sequence (framecheck sequence, FCS) field

最大报文长度(Maximum Segment Size,MSS)用于表示应用层数据的最大长度;示例性的,如图2所示,该MSS包括数据帧中IP数据的长度,也可以理解为报文段的长度。The maximum segment size (Maximum Segment Size, MSS) is used to represent the maximum length of application layer data; exemplarily, as shown in Figure 2, the MSS includes the length of the IP data in the data frame, which can also be understood as the length of the segment. length.

可理解的,在以太网协议中,数据帧也可以称为以太网帧或MAC帧。Understandably, in the Ethernet protocol, the data frame may also be referred to as an Ethernet frame or a MAC frame.

示例性的,在网际协议版本4(Internet Protocol version 4,IPV4)中,IP首部的长度为20字节(byte),TCP首部的长度为20byte。在网际协议版本6(Internet Protocolversion 6,IPV6)中,IP首部的长度为40byte,TCP首部的长度为20byte。Exemplarily, in Internet Protocol version 4 (Internet Protocol version 4, IPV4), the length of the IP header is 20 bytes (byte), and the length of the TCP header is 20 bytes. In Internet Protocol version 6 (Internet Protocol version 6, IPV6), the length of the IP header is 40 bytes, and the length of the TCP header is 20 bytes.

可理解的,两个网际协议版本不一致的设备之间可以通过IPV4/IPV6双协议栈(同时支持IPv4和IPv6协议)实现相互通信。Understandably, two devices with different versions of Internet protocols can communicate with each other through an IPV4/IPV6 dual protocol stack (supporting both IPv4 and IPv6 protocols).

3、TCP三次握手3. TCP three-way handshake

传输控制协议(Transmission Control Protocol,TCP)/网络互联协议(InternetProtocol,IP),也称TCP/IP协议栈、TCP/IP协议或网络通讯协议,是用于因特网(Internet)中实现不同网络间的信息传输的通信协议的总称。其中,TCP/IP协议栈可以包括IP、TCP、ICMP、UDP、TELNET或FTP、以及HTTP中的一项或多项。Transmission Control Protocol (TCP)/Internet Protocol (IP), also known as TCP/IP protocol stack, TCP/IP protocol or network communication protocol, is used to implement communication between different networks in the Internet. A general term for communication protocols for information transmission. The TCP/IP protocol stack may include one or more of IP, TCP, ICMP, UDP, TELNET or FTP, and HTTP.

网络间的信息传输除了需要TCP/IP协议之外,还需要用于实现链路层的数据传输和地址封装的协议,例如以太网协议或802.3协议。In addition to the TCP/IP protocol, information transmission between networks also requires protocols for implementing data transmission and address encapsulation at the link layer, such as the Ethernet protocol or the 802.3 protocol.

一般地,以太网协议的数据链路支持的MTU为1500字节(byte)。由于MSS等于MTU减去TCP首部长度再减去IP首部长度,从而,在IPV4中,以太网协议支持的MSS为1460字节。Generally, the MTU supported by the data link of the Ethernet protocol is 1500 bytes. Since MSS is equal to MTU minus the length of the TCP header and then minus the length of the IP header, in IPV4, the MSS supported by the Ethernet protocol is 1460 bytes.

802.3协议的数据链路支持的MTU为1492字节,从而,在IPV4中,802.3协议支持的MSS为1452。The MTU supported by the data link of the 802.3 protocol is 1492 bytes, so in IPV4, the MSS supported by the 802.3 protocol is 1452.

一般地,若想要客户端和服务端之间的通信为可靠通信,客户端和服务端中配置的TCP/IP协议中至少包括IP和TCP协议,其中,TCP协议可以为客户端和服务端之间的通信提供可靠的数据传输。Generally, if you want the communication between the client and the server to be reliable communication, the TCP/IP protocols configured in the client and the server at least include IP and TCP protocols, where the TCP protocol can be the client and the server. Communication between them provides reliable data transfer.

在客户端和服务端之间通过TCP进行可靠的通信之前,客户端和服务端之间要进行TCP三次握手,该TCP三次握手至少用于协商客户端和服务端之间进行数据传输的最大报文长度。Before reliable communication between the client and the server through TCP, a TCP three-way handshake should be performed between the client and the server. The TCP three-way handshake is at least used to negotiate the maximum size of the data transmission between the client and the server. text length.

示例性的,如下图2所示,客户端A和服务端B的三次握手包括以下步骤:Exemplarily, as shown in Figure 2 below, the three-way handshake between client A and server B includes the following steps:

S201,客户端A向服务端B发送同步序列编号SYN,相应地,服务端B接收客户端A发送的SYN。S201 , the client A sends the synchronization sequence number SYN to the server B, and accordingly, the server B receives the SYN sent by the client A.

上述SYN中携带客户端A期望接收的报文段的最大数据长度,也即上述SYN中携带客户端A的MSS。The above SYN carries the maximum data length of the segment that client A expects to receive, that is, the above SYN carries the MSS of client A.

同步序列编号(Synchronize Sequence Numbers,SYN),是TCP/IP建立连接时使用的第一个握手信号。Synchronize Sequence Numbers (SYN) is the first handshake signal used by TCP/IP when establishing a connection.

上述客户端A的最大报文长度的值是通过驻网时核心网发送的MTU计算得到。具体的,由MTU减去数值a得到,该数值a为TCP首部长度和IP首部长度的和,该TCP首部长度和该IP首部长度分别为与客户端A中配置的网络链路的协议类型对应的TCP首部长度和IP首部长度。The value of the maximum packet length of the above-mentioned client A is calculated by the MTU sent by the core network when the network is on. Specifically, it is obtained by subtracting the value a from the MTU. The value a is the sum of the length of the TCP header and the length of the IP header. The length of the TCP header and the length of the IP header correspond to the protocol type of the network link configured in client A, respectively. The length of the TCP header and the length of the IP header.

示例性的,该客户端A中配置的网络链路协议为以太网协议,则该客户端A驻网时接收到核心网发送的MTU为1500字节,并经过换算得到该客户端A的MSS为1460字节。Exemplarily, the network link protocol configured in the client A is the Ethernet protocol, then the MTU received by the core network when the client A resides on the network is 1500 bytes, and the MSS of the client A is obtained after conversion. is 1460 bytes.

一般地,服务端B接收客户端A发送的SYN,并解析得到客户端A的MSS后,将客户端A的MSS与自身的MSS作比较,并将较小值作为参数X的值存储到服务端B中,之后服务端B向客户端A发送数据时,会根据该参数X的值确定向客户端A发送的报文段的长度。Generally, server B receives the SYN sent by client A, and after parsing and obtaining the MSS of client A, compares the MSS of client A with its own MSS, and stores the smaller value as the value of parameter X in the service In terminal B, when server B sends data to client A, it will determine the length of the segment sent to client A according to the value of the parameter X.

S202,服务端B向客户端A发送应答报文SYN+ACK,相应地,客户端A接收服务端B发送的SYN+ACK。S202 , the server B sends a response packet SYN+ACK to the client A, and accordingly, the client A receives the SYN+ACK sent by the server B.

上述SYN+ACK中携带服务端B期望接收的报文段的MSS。该SYN+ACK是服务端B在接收到客户端A发送的SYN同步序列编号后做出的应答,用于表示服务端B接收到该SYN信令,以及用于表示服务端B期望接收的报文段的MSS。The above SYN+ACK carries the MSS of the segment that the server B expects to receive. The SYN+ACK is the response made by server B after receiving the SYN synchronization sequence number sent by client A, which is used to indicate that server B has received the SYN signaling, and is used to indicate that server B expects to receive the message. The MSS of the text.

一般地,客户端A接收到服务端B发送的SYN+ACK,并解析得到服务端B的MSS后,将服务端B的MSS与自身的MSS作比较,并将较小值作为参数Y的值存储到客户端A中,之后客户端A向服务端B发送数据时,会根据该参数Y的值确定向服务端B发送的报文段的长度。Generally, after client A receives the SYN+ACK sent by server B, and parses the MSS of server B, it compares the MSS of server B with its own MSS, and uses the smaller value as the value of parameter Y. Store the data in client A, and then when client A sends data to server B, it will determine the length of the segment sent to server B according to the value of the parameter Y.

S203,客户端A向服务端B发送应答报文ACK,相应的,服务端B接收客户端A发送的应答报文ACK。S203 , the client A sends a response packet ACK to the server B, and correspondingly, the server B receives the response packet ACK sent by the client A.

上述ACK是客户端A在接收到服务端B发送的AYN+ACK后做出的应答,用于表示客户端A已接收到该AYN+ACK。The above ACK is a response made by client A after receiving the AYN+ACK sent by server B, which is used to indicate that client A has received the AYN+ACK.

从而,根据上述步骤S201至S203,客户端A与服务端B都分别确定以两者的MSS中的较小值作为发送的报文段的长度,也可以理解为客户端A与服务端B协商通信时发送的报文段的MSS。Therefore, according to the above steps S201 to S203, both client A and server B respectively determine the length of the message segment sent by the smaller value of the MSS of the two, which can also be understood as the negotiation between client A and server B. The MSS of the segment sent during communication.

然而,采用上述步骤S201至S203中的方法,只考虑到了客户端A与服务端B两者的MSS,而未考虑到客户端A和服务端B之间通信经过的运营商网络(核心网)的MSS。示例性的,若客户端A与服务端B配置的数据链路的协议均为以太网协议,而客户端A和服务端B之间通信经过的运营商网络的数据链路的协议为802.3协议;则采用上述步骤S101至S103中的方法确定到的客户端A与服务端B通信时发生的报文段的MSS为1460字节,而运营商网络的MSS为1452字节,则客户端A根据1460字节向服务端B发送数据帧进行通信时,数据帧到达运营商网络后,运营商网络需要对数据帧进行分片传输,且分片后的数据到达目的端服务端B后,通信装置还需要将分片数据进行重组。服务端B根据1460字节向客户端A发送数据帧亦如此。从而,大量数据包的分片和重组,会造成网络资源利用率低、浪费中央处理器(CPU)的处理资源和网络宽带资源等问题,甚至会造成网络拥塞,同时也会降低无线通信模组的数据传输效率。However, using the methods in the above steps S201 to S203, only the MSSs of the client A and the server B are considered, but the operator network (core network) through which the communication between the client A and the server B passes is not considered. MSS. Exemplarily, if the protocol of the data link configured by client A and server B is the Ethernet protocol, and the protocol of the data link of the carrier network through which the communication between client A and server B passes is the 802.3 protocol Then adopt the method in the above-mentioned steps S101 to S103 to determine that the MSS of the message segment that occurs when the client A communicates with the server B is 1460 bytes, and the MSS of the operator network is 1452 bytes, then the client A When sending a data frame to server B according to 1460 bytes for communication, after the data frame reaches the operator network, the operator network needs to fragment the data frame, and after the fragmented data reaches the destination server B, the communication The device also needs to reorganize the fragmented data. The same is true for server B sending a data frame to client A according to 1460 bytes. Therefore, the fragmentation and reassembly of a large number of data packets will cause problems such as low utilization of network resources, waste of processing resources of the central processing unit (CPU) and network bandwidth resources, and even cause network congestion, and will also reduce the wireless communication module. data transmission efficiency.

可理解的,本申请实施例所描述的数据长度(例如MSS或MTU)也可以理解为数据量大小,示例性的,最大报文长度为1460字节,也可以理解为数据帧中负载或IP数据的数据量的大小为1460字节。It can be understood that the data length (for example, MSS or MTU) described in the embodiments of this application can also be understood as the size of the data volume. Exemplarily, the maximum packet length is 1460 bytes, which can also be understood as the payload or IP in the data frame. The size of the data amount of data is 1460 bytes.

实施例1:Example 1:

以下结合图3介绍本申请实施例提供的数据通信方法。The following describes the data communication method provided by the embodiment of the present application with reference to FIG. 3 .

如图3所示,该数据通信方法包括:As shown in Figure 3, the data communication method includes:

S301,客户端获取基站发送的第一报文长度,并确定该第一报文长度和第二报文长度中较小的报文长度为第三报文长度。S301, the client obtains the length of the first packet sent by the base station, and determines that the length of the smaller of the length of the first packet and the length of the second packet is the third packet length.

在本申请实施例中,上述第一报文长度为运营商网络确定的最大数据长度(Maximum Segment Size,MSS)。上述第二报文长度为上述客户端期望接收到的报文段的MSS。In this embodiment of the present application, the above-mentioned first packet length is the maximum data length (Maximum Segment Size, MSS) determined by the operator network. The length of the second message is the MSS of the message segment expected to be received by the client.

可理解的,上述运营商网络即为客户端所使用的移动通信网络运营商,例如移动运营商网络、联通运营商网络或电信运营商网络。整个运营商网络可以包含一个或多个基站以及一个或多个和核心网设备。It is understandable that the above-mentioned operator network is the mobile communication network operator used by the client, such as a mobile operator network, a China Unicom operator network or a telecom operator network. The entire operator network may contain one or more base stations and one or more core network devices.

在一种可能的实现方式中,上述获取基站发送的第一报文长度,具体包括:获取所述基站发送的第一最大传输单元MTU,按照公式“第一报文长度=第一最大传输单元MTU-IP首部长度-TCP首部长度”计算所述第一报文长度;其中所述第一最大传输单元MTU由所述运营商网络确定,所述IP首部长度和所述TCP首部长度分别为与所述客户端中配置的网络协议版本对应的IP首部长度和TCP首部长度。In a possible implementation manner, obtaining the first message length sent by the base station as described above specifically includes: obtaining the first maximum transmission unit MTU sent by the base station, according to the formula "first message length=first maximum transmission unit" MTU-IP header length-TCP header length" calculates the first message length; wherein the first maximum transmission unit MTU is determined by the operator network, and the IP header length and the TCP header length are respectively the same as The length of the IP header and the length of the TCP header corresponding to the network protocol version configured in the client.

在一种可能的实现方式中,上述获取所述基站发送的第一最大传输单元MTU,具体包括:在上述客户端驻网时,接收上述基站发送的分组数据网(Packet Data Network,PDN)数据包,上述PDN数据包中包括上述第一最大传输单元(Maximum Transmission Unit,MTU)。In a possible implementation manner, obtaining the first maximum transmission unit MTU sent by the base station specifically includes: when the client resides on the network, receiving Packet Data Network (PDN) data sent by the base station The above-mentioned first maximum transmission unit (Maximum Transmission Unit, MTU) is included in the above-mentioned PDN data packet.

可理解的,上述第一报文长度为运营商网络确定的最大数据长度,也可以理解为,运营商网络通过上述第一MTU确定上述第一报文长度。具体的:由运营商网络给客户端配置的第一MTU确定上述第一报文长度。其中,运营商网络会在客户端驻网到上述基站时,通过核心网以及基站向客户端发送PDN数据包,该PDN数据包中包括该第一MTU。客户端再根据该第一MTU以及第一MTU和MSS的转换公式计算得到上述第一报文长度。该第一报文长度也可以理解为运营商网络给客户端配置的,当运营商网络与客户端通信时,运营商网络不需要将报文段进行分段传输的MSS值。也就是说,该第一报文段长度只是运营商网络根据需求给客户端配置的MSS值,不能代表运营商网络支持的最大MSS值为该第一报文长度,该运营商网络还可以支持比该第一报文长度更大的MSS值,本文对此不做限定。It is understandable that the above-mentioned first packet length is the maximum data length determined by the operator's network, and it can also be understood that the above-mentioned first packet length is determined by the above-mentioned first MTU by the operator's network. Specifically: the above-mentioned first packet length is determined by the first MTU configured for the client by the operator network. The operator network will send a PDN data packet to the client through the core network and the base station when the client resides on the network and the base station, and the PDN data packet includes the first MTU. The client then calculates the above-mentioned first packet length according to the first MTU and the conversion formula between the first MTU and the MSS. The first packet length can also be understood as an MSS value configured by the operator network for the client, and when the operator network communicates with the client, the operator network does not need an MSS value for segmented transmission of the packet. That is to say, the length of the first segment is only the MSS value configured for the client by the operator network according to the requirements, and cannot represent the maximum MSS value supported by the operator network. The length of the first segment can also be supported by the operator network. The MSS value that is larger than the length of the first packet is not limited in this document.

在本申请实施例中,上述第二报文长度为上述客户端本身期望接收到的报文段的最大数据长度(即客户端的MSS)。In this embodiment of the present application, the above-mentioned second packet length is the maximum data length of the packet segment that the above-mentioned client itself expects to receive (ie, the MSS of the client).

S302,通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据该第三报文长度和该第四报文长度中较小的报文长度确定目标报文长度。S302, obtain the fourth packet length sent by the server through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and determine the target according to the smaller packet length of the third packet length and the fourth packet length Packet length.

示例性的,上述客户端基于TCP/IP协议栈与服务端进行TCP三次握手中的第二次TCP握手时,接收服务端发送的上述第四报文长度。Exemplarily, when the client performs the second TCP handshake in the TCP three-way handshake with the server based on the TCP/IP protocol stack, the client receives the fourth packet length sent by the server.

示例性的,运营商网络中配置的用于实现与客户端进行链路层的数据传输和地址封装的协议为802.3协议,客户端接收到基站发送的上述第一MTU为1492字节,且基站与该客户端配置的网络协议版本为IPV4,则上述第一报文长度的值为(1492-20-20)字节=1452字节。客户端中配置的用于实现链路层的数据传输和地址封装的协议为以太网协议,则客户端自身的MTU为1500字节,也即上述第二报文长度的值为(1500-20-20)字节=1500字节。若服务端配置的用于实现链路层的数据传输和地址封装的协议也为以太网协议,则服务端的MTU为1500字节,也即上述第四报文长度的值为(1500-20-20)字节=1500字节。从而,第一报文长度(1452字节)、第二报文长度(1500字节)以及第四报文长度(1500字节)中的最小报文长度即为第一报文长度,则确定上述第一报文长度为上述目标报文长度。Exemplarily, the protocol configured in the operator network for implementing link layer data transmission and address encapsulation with the client is the 802.3 protocol, the first MTU received by the client from the base station is 1492 bytes, and the base station If the version of the network protocol configured with the client is IPV4, the value of the above-mentioned first packet length is (1492-20-20) bytes=1452 bytes. The protocol configured in the client to realize the data transmission and address encapsulation of the link layer is the Ethernet protocol, then the MTU of the client itself is 1500 bytes, that is, the value of the above-mentioned second packet length is (1500-20 -20) bytes = 1500 bytes. If the protocol configured by the server to implement data transmission and address encapsulation at the link layer is also an Ethernet protocol, the MTU of the server is 1500 bytes, that is, the value of the fourth packet length above is (1500-20- 20) bytes = 1500 bytes. Therefore, the minimum packet length among the first packet length (1452 bytes), the second packet length (1500 bytes) and the fourth packet length (1500 bytes) is the first packet length, and it is determined that The above-mentioned first packet length is the above-mentioned target packet length.

示例性的,若上述第一报文长度、第二报文长度和第四报文长度中的最小报文长度为第一报文长度,则确定该第一报文长度为上述目标报文长度。若上述第一报文长度、第二报文长度和第四报文长度中的最小报文长度为第二报文长度,则确定该第二报文长度为上述目标报文长度。若上述第一报文长度、第二报文长度和第四报文长度中的最小报文长度为第四报文长度,则确定该第四报文长度为上述目标报文长度。Exemplarily, if the minimum packet length among the above-mentioned first packet length, second packet length and fourth packet length is the first packet length, then it is determined that the first packet length is the above-mentioned target packet length . If the minimum packet length among the first packet length, the second packet length, and the fourth packet length is the second packet length, the second packet length is determined to be the above-mentioned target packet length. If the minimum packet length among the first packet length, the second packet length, and the fourth packet length is the fourth packet length, the fourth packet length is determined to be the above-mentioned target packet length.

一般地,基站或者与基站通信的核心网的网际协议版本至少存在一个与接入基站的设备的网际协议版本一致的网际协议版本。例如,基站的网际协议版本为IPV4/IPV6,接入该基站的客户端的网际协议版本为IPV4,这时,基站与客户端的通信以客户端支持的网际协议版本为准。也就是说,这种情况下,客户端接收到的基站发送的MTU后,以IPV4中定义的IP首部的长度和TCP首部的长度为准计算上述第一报文长度。Generally, the Internet protocol version of the base station or the core network that communicates with the base station has at least one Internet protocol version that is consistent with the Internet protocol version of the device accessing the base station. For example, the Internet protocol version of the base station is IPV4/IPV6, and the Internet protocol version of the client accessing the base station is IPV4. At this time, the communication between the base station and the client is based on the Internet protocol version supported by the client. That is to say, in this case, after the client receives the MTU sent by the base station, the length of the first packet is calculated based on the length of the IP header and the length of the TCP header defined in IPV4.

S303,通过上述基站向上述服务端发送第一报文段,该第一报文段的长度基于上述目标报文长度确定。S303: Send a first segment to the server through the base station, where the length of the first segment is determined based on the length of the target message.

示例性的,上述客户端向服务端发送第一报文段,具体可以是上述客户端中的应用层向客户端中的网络层发送上述第一报文段;网络层根据该第一报文段、TCP首部以及IP首部确定向数据链路层发送的数据包;客户端的数据链路层再根据该第一报文段、TCP首部、IP首部以及以太网首部形成第一数据帧,并经由物理层向服务端发送该第一数据帧。该第一数据帧包括该第一报文段,该第一数据帧中的该第一报文段的长度与上述目标报文段长度一致。Exemplarily, the above-mentioned client sends the first message segment to the server, specifically, the application layer in the above-mentioned client sends the above-mentioned first message segment to the network layer in the client; the network layer is based on the first message. segment, TCP header, and IP header determine the data packet sent to the data link layer; the client's data link layer then forms a first data frame according to the first segment, TCP header, IP header and Ethernet header, and via The physical layer sends the first data frame to the server. The first data frame includes the first segment, and the length of the first segment in the first data frame is consistent with the length of the target segment.

可理解的,上述第一数据帧中还可以包括除第一报文段、TCP首部、IP首部以及以太网首部之外的其他字段,本文对此不做限定,例如该第一数据帧中还可以包括帧检验序列(frame check sequence,FCS)字段。It is understandable that the above-mentioned first data frame may also include other fields except the first message segment, the TCP header, the IP header and the Ethernet header, which are not limited in this paper. A frame check sequence (FCS) field may be included.

示例性的,上述客户端包括主机和无线通信模组,可以由客户端中的主机和无线通信模组配合执行上述步骤S301-S303。例如,可以由无线通信模组执行步骤S301;由无线通信模组执行步骤S302中的通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,由无线通信模组或主机执行步骤S302中的根据该第三报文长度和该第四报文长度中较小的报文长度确定目标报文长度;由主机通过无线通信模组执行步骤S303。Exemplarily, the above-mentioned client includes a host and a wireless communication module, and the above-mentioned steps S301-S303 may be performed by the host and the wireless communication module in the client in cooperation. For example, step S301 may be executed by the wireless communication module; step S302 may be executed by the wireless communication module to obtain the length of the fourth message sent by the server through the transmission control protocol/network interconnection protocol TCP/IP protocol stack, and the length of the fourth message sent by the wireless communication module may be executed by the wireless communication module. The group or the host performs step S302 to determine the target message length according to the smaller message length of the third message length and the fourth message length; the host performs step S303 through the wireless communication module.

由此,客户端根据上述目标报文长度向服务端发送数据进行通信,数据传输到运营商网络(基站或核心网)后,运营商网络不会再对数据进行分片处理,数据到达服务端后也不需要进行重组处理,从而提高了网络资源利用率、节省CPU处理资源和网络宽带资源,避免网络拥塞,提高无线通信模组的数据传输效率。Therefore, the client sends data to the server for communication according to the above target message length. After the data is transmitted to the operator's network (base station or core network), the operator's network will no longer fragment the data, and the data arrives at the server. Afterwards, there is no need to perform reorganization processing, thereby improving the utilization rate of network resources, saving CPU processing resources and network broadband resources, avoiding network congestion, and improving the data transmission efficiency of the wireless communication module.

可理解的,当上述客户端为上述无线通信模组时,采用本申请实施例提供的方法可以使得无线通信模组不仅作为数据的传输工具,还可以智能化地处理一些业务(例如确定上述目标报文长度的业务)以节省网络资源,帮助提升整个网络的数据业务处理能力。It is understandable that when the above-mentioned client is the above-mentioned wireless communication module, the method provided by the embodiment of the present application can make the wireless communication module not only serve as a data transmission tool, but also intelligently process some services (for example, determine the above-mentioned target). packet length services) to save network resources and help improve the data service processing capability of the entire network.

在本申请实施例中,客户端可以通过以下两种获取方式获取上述第一报文长度。In this embodiment of the present application, the client may obtain the above-mentioned first packet length through the following two obtaining methods.

1、客户端可以在驻网时,获取(接收)到第一MTU之后、以及检测到触发客户端与服务端进行TCP三次握手的触发指令之前,计算上述第一报文长度。1. When the client is on the network, after acquiring (receiving) the first MTU, and before detecting the trigger instruction that triggers the client and the server to perform the TCP three-way handshake, the above-mentioned first packet length can be calculated.

具体的,上述获取第一MTU,具体包括:在上述客户端驻网时,接收上述基站发送的分组数据网PDN数据包,该PDN数据包中包括上述第一MTU;上述将该第一MTU与第一数值的差值作为该第一报文长度,具体包括:在检测到触发指令之前,计算该第一MTU与第一数值的差值,得到上述第一报文长度,该触发指令用于指示客户端与服务端进行TCP三次握手。Specifically, the above-mentioned obtaining the first MTU specifically includes: when the above-mentioned client resides on the network, receiving a packet data network PDN data packet sent by the above-mentioned base station, where the PDN data packet includes the above-mentioned first MTU; The difference of the first value is used as the length of the first message, which specifically includes: before the trigger instruction is detected, calculating the difference between the first MTU and the first value to obtain the above-mentioned first message length, and the trigger instruction is used for Instructs the client to perform a three-way TCP handshake with the server.

示例性的,客户端在开机后执行驻网流程。驻网流程具体可以是客户端向小区A对应的基站发送驻网请求,若该基站未存储有与该客户端对应的MTU信息,则基站将该驻网请求上报到核心网,核心网再向该基站发送关于该客户端的attach报文。可理解的,上述attach报文是核心网通过基站向客户端发送的,一般地,只要客户端接入的核心网未更换,就算客户端更换了小区,核心网也不会再次向客户端发送该attach报文。Exemplarily, after the client is powered on, the process of staying on the network is performed. Specifically, the process of staying on the network can be that the client sends a request to the base station corresponding to cell A. If the base station does not store the MTU information corresponding to the client, the base station reports the request to the core network, and the core network sends the request to the core network. The base station sends an attach message about the client. It is understandable that the above attach message is sent by the core network to the client through the base station. Generally, as long as the core network accessed by the client is not changed, even if the client changes the cell, the core network will not send it to the client again. The attach message.

示例性的,上述触发指令是基于移动通信业务触发,例如该移动通信业务可以是通过拨号、浏览网页、或下载数据等业务。Exemplarily, the above triggering instruction is triggered based on a mobile communication service, for example, the mobile communication service may be a service such as dialing up, browsing a web page, or downloading data.

一般地,客户端驻网的过程称为附着(Attach),客户端向通过基站向核心网发送驻网请求后,核心网响应于该驻网请求向客户端发送attach报文,该attach报文中包括分组数据网(Packet Data Network,PDN)容器,该PDN容器中包括协议配置选项(ProtocolConfiguration Options,PCO),该PCO中包括MTU字段,该MTU字段即用于表示运营商网络期望接收到的数据帧中TCP首部长度、IP首部长度以及报文段长度的和。该客户端接收到上述attach报文后解析得到上述PCO中包括的MTU字段,将该MTU字段的值作为上述第一MTU的值,从而客户端获取到上述第一MTU。Generally, the process of the client staying on the network is called attach. After the client sends an on-network request to the core network through the base station, the core network sends an attach message to the client in response to the on-network request. The attach message It includes a Packet Data Network (PDN) container, the PDN container includes a Protocol Configuration Options (PCO), and the PCO includes an MTU field, which is used to indicate that the operator network expects to receive The sum of the length of the TCP header, the length of the IP header, and the length of the segment in the data frame. After receiving the attach message, the client obtains the MTU field included in the PCO, and uses the value of the MTU field as the value of the first MTU, so that the client obtains the first MTU.

可理解的,客户端与核心网之间的通信可能会经过一个或多个基站,本文对此不做限定。Understandably, the communication between the client and the core network may pass through one or more base stations, which is not limited herein.

2、客户端也可以在获取到第一MTU后,存储该第一MTU。在客户端检测到上述触发指令后,再读取存储的该第一MTU,根据该第一MTU计算得到上述第一报文长度。2. The client may also store the first MTU after obtaining the first MTU. After the client detects the trigger instruction, the client reads the stored first MTU, and calculates the first packet length according to the first MTU.

具体的,上述获取第一MTU,具体包括:在客户端驻网时,接收核心网发送的分组数据网PDN数据包,该PDN数据包中包括上述第一MTU;存储该第一MTU;上述将该第一MTU与第一数值的差值作为该第一报文长度,具体包括:在检测到触发指令后,根据存储的该第一MTU计算该第一MTU与第一数值的差值,得到该第一报文长度,该触发指令用于触发客户端与服务端进行TCP三次握手。Specifically, the above-mentioned obtaining the first MTU specifically includes: when the client resides on the network, receiving a packet data network PDN data packet sent by the core network, where the PDN data packet includes the above-mentioned first MTU; storing the first MTU; The difference between the first MTU and the first numerical value is used as the length of the first message, which specifically includes: after detecting the trigger instruction, calculating the difference between the first MTU and the first numerical value according to the stored first MTU, and obtaining The first packet length, the trigger instruction is used to trigger the client and the server to perform a TCP three-way handshake.

可理解的,可以由客户端执行本申请实施例提供的数据通信方法,服务端配合客户端执行本申请实施例提供的数据通信方法,例如,服务端配合客户端执行TCP三次握手,客户端根据上述步骤S301至S303执行本申请实施例提供的数据通信方法。It is understandable that the data communication method provided by the embodiment of the present application may be executed by the client, and the data communication method provided by the embodiment of the present application may be executed by the server in cooperation with the client. The above steps S301 to S303 execute the data communication method provided by the embodiment of the present application.

示例性的,客户端执行本申请实施例提供的数据通信方法的同时,服务端也可以同时执行本申请实施例提供的数据通信方法。Exemplarily, while the client side executes the data communication method provided by the embodiment of the present application, the server side may also simultaneously execute the data communication method provided by the embodiment of the present application.

示例性的,记上述客户端通过基站与服务端通信中的基站为第一基站,上述第一报文长度为运营商网络确定的最大数据长度中的运营商网络为第一运营商网络。在客户端和服务端同时执行本申请实施例提供的数据通信方法的情况下,上述第四报文长度为服务端期望接收到的报文段的最大数据长度具体包括:上述第四报文长度为上述服务端期望接收到的报文段的最大数据长度和第二基站向该服务端发送的第五报文长度中的较小值,该服务端通过该第二基站向所述客户端发送数据以进行数据通信,该第五报文长度为第二运营商网络确定的最大数据长度。可理解的,上述第一基站可以是一个或多个基站的集合,上述第二基站也可以是一个或多个基站的集合,上述第一基站与第二基站可以包括一个或多个相同的基站,本文对此不做限定。Exemplarily, the base station in which the client communicates with the server through the base station is the first base station, and the operator network in which the first packet length is the maximum data length determined by the operator network is the first operator network. In the case where the client and the server simultaneously execute the data communication method provided by the embodiment of the present application, the above-mentioned fourth packet length is the maximum data length of the packet segment expected to be received by the server, specifically including: the above-mentioned fourth packet length is the smaller of the maximum data length of the message segment that the server expects to receive and the length of the fifth message sent by the second base station to the server, and the server sends to the client through the second base station data for data communication, and the fifth packet length is the maximum data length determined by the second operator network. Understandably, the first base station may be a set of one or more base stations, the second base station may also be a set of one or more base stations, and the first base station and the second base station may include one or more identical base stations. , which is not limited in this paper.

实施例2:Example 2:

在本申请实施例中,上述客户端包括主机和无线通信模组,上述TCP/IP协议栈配置于所述无线通信模组,上述步骤S302中通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据该第三报文长度和该第四报文长度中较小的报文长度确定目标报文长度,包括:所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述第三报文长度;所述无线通信模组通过所述TCP/IP协议栈接收所述服务端发送的所述第四报文长度;所述无线通信模组确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度。上述无线通信模组即为无线通信模组。In the embodiment of the present application, the above-mentioned client includes a host and a wireless communication module, the above-mentioned TCP/IP protocol stack is configured in the above-mentioned wireless communication module, and in the above-mentioned step S302, the transmission control protocol/network interconnection protocol TCP/IP protocol stack is used. Obtaining the fourth packet length sent by the server, and determining the target packet length according to the smaller packet length of the third packet length and the fourth packet length, including: the wireless communication module passing the The TCP/IP protocol stack sends the third packet length to the server; the wireless communication module receives the fourth packet length sent by the server through the TCP/IP protocol stack; the wireless communication module receives the fourth packet length sent by the server through the TCP/IP protocol stack; The wireless communication module determines that the smaller message length of the third message length and the fourth message length is the target message length. The above wireless communication module is a wireless communication module.

示例性的,客户端与服务端之间的通信装置示意图如图4A所示。可理解的,TCP/IP协议栈配置于无线通信模组中,则由无线通信模组触发与服务端进行TCP三次握手的流程。示例性的,上述主机也可以理解为应用层的应用处理器,无线通信模组也可以理解为基带处理器。在TCP/IP协议栈配置于无线通信模组中的场景下,客户端中的主机在运行目标软件程序时(例如需要采用移动通信下载文件等软件程序),主机向无线通信模组发送请求与服务端通信的指令后,由无线通信模组触发客户端与服务端的三次握手流程,并由无线通信模组与服务端完成TCP三次握手流程。Exemplarily, a schematic diagram of a communication device between a client and a server is shown in FIG. 4A . Understandably, the TCP/IP protocol stack is configured in the wireless communication module, and the wireless communication module triggers the process of performing the TCP three-way handshake with the server. Exemplarily, the above-mentioned host may also be understood as an application processor at the application layer, and the wireless communication module may also be understood as a baseband processor. In the scenario where the TCP/IP protocol stack is configured in the wireless communication module, when the host in the client runs the target software program (for example, software programs such as files need to be downloaded through mobile communication), the host sends a request to the wireless communication module with After the server communicates with the instruction, the wireless communication module triggers the three-way handshake process between the client and the server, and the wireless communication module and the server complete the TCP three-way handshake process.

具体的,以下结合图4B详细介绍在TCP/IP协议栈配置于无线通信模组的场景下,本申请实施例提供的又一种数据通信方法。Specifically, another data communication method provided by an embodiment of the present application is described in detail below with reference to FIG. 4B in a scenario where a TCP/IP protocol stack is configured in a wireless communication module.

如图4B所示,该数据通信方法包括以下步骤:As shown in Figure 4B, the data communication method includes the following steps:

S401,无线通信模组获取基站发送的第一报文长度。S401, the wireless communication module obtains the length of the first packet sent by the base station.

关于无线通信模组具体如何获取第一报文长度的说明可以参照本文其他实施例的相关说明,例如上述步骤S301中客户端获取第一报文长度的相关说明,在此不再详述。For the specific description of how the wireless communication module obtains the first packet length, reference may be made to the relevant descriptions of other embodiments herein, for example, the relevant descriptions of the client acquiring the first packet length in the above step S301, which will not be described in detail here.

S402,无线通信模组确定上述第一报文长度和上述第二报文长度中较小的报文长度为第三报文长度。S402, the wireless communication module determines that the smaller one of the first packet length and the second packet length is the third packet length.

在本申请实施例中,上述第二报文长度为客户端期望接收到的报文段的最大数据长度(即客户端的MSS)。In the embodiment of the present application, the above-mentioned second packet length is the maximum data length of the packet segment expected to be received by the client (ie, the MSS of the client).

S403,无线通信模组向服务端发送上述第三报文长度,相应的,服务端接收该第三报文长度。S403, the wireless communication module sends the above-mentioned third packet length to the server, and accordingly, the server receives the third packet length.

具体的,无线通信模组检测到与服务端进行TCP三次握手的触发指令的情况下,向服务端发送SYN报文以进行TCP三次握手中的第一次握手动作,该SYN报文中携带上述第三报文长度。关于TCP三次握手和SYN报文的相关描述可以参照本申请其他实施例的相关描述,在此不再详述。Specifically, when the wireless communication module detects the trigger command for performing the TCP three-way handshake with the server, it sends a SYN packet to the server to perform the first handshake in the TCP three-way handshake, and the SYN packet carries the above-mentioned three-way handshake. The third packet length. For the relevant description of the TCP three-way handshake and the SYN message, reference may be made to the relevant descriptions of other embodiments of the present application, which will not be described in detail here.

S404,无线通信模组接收服务端发送的第四报文长度。S404, the wireless communication module receives the fourth packet length sent by the server.

在本申请实施例中,第四报文长度即为服务端期望接收到的报文段的最大数据长度(即服务端的MSS)。In the embodiment of the present application, the fourth packet length is the maximum data length of the packet segment expected to be received by the server (ie, the MSS of the server).

具体的,在服务端接收到客户端发送的包含上述第三报文长度的SYN报文后,服务端响应于该SYN报文,向客户端发送响应报文SYN+ACK报文以进行TCP三次握手中的第二次握手,其中该SYN+ACK报文中包括上述第四报文长度。Specifically, after the server receives the SYN message containing the length of the third message sent by the client, the server responds to the SYN message and sends a response message SYN+ACK message to the client to perform TCP three times The second handshake in the handshake, wherein the SYN+ACK message includes the above-mentioned fourth message length.

S405,无线通信模组确定上述第三报文长度和上述第四报文长度中较小的报文长度为上述目标报文长度。S405 , the wireless communication module determines that the smaller one of the third packet length and the fourth packet length is the target packet length.

具体的,无线通信模组在接收到服务端发送的SYN+ACK报文,并解析得到上述第四报文长度后,确定将上述第三报文长度和第四报文长度中较小的报文长度作为与服务端进行通信的报文长度(也即上述目标报文长度)。Specifically, after receiving the SYN+ACK message sent by the server, and analysing the length of the fourth message, the wireless communication module determines to use the smaller of the third message length and the fourth message length. The message length is used as the message length for communication with the server (that is, the above-mentioned target message length).

S406,无线通信模组向服务端发送ACK应答报文。S406, the wireless communication module sends an ACK response message to the server.

在一种可能的实现方式中,在上述步骤S405(无线通信模组确定上述第三报文长度和上述第四报文长度中较小的报文长度为上述目标报文长度)之后,步骤S406(无线通信模组通过上述基站向服务端发送第一报文段)之前,所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述目标报文长度,以使得所述客户端和所述服务端基于所述目标报文长度进行数据通信。In a possible implementation manner, after the above-mentioned step S405 (the wireless communication module determines that the smaller one of the above-mentioned third packet length and the above-mentioned fourth packet length is the above-mentioned target packet length), step S406 Before (the wireless communication module sends the first message segment to the server through the base station), the wireless communication module sends the target message length to the server through the TCP/IP protocol stack, so that all The client and the server perform data communication based on the target message length.

示例性的,为完成TCP三次握手,以确保客户端和服务端之间的通信为可靠通信,客户端会在与服务端进行正常通信之前,向服务端发送ACK应答报文,且该ACK报文包括上述目标报文长度。Exemplarily, in order to complete the TCP three-way handshake to ensure that the communication between the client and the server is reliable communication, the client sends an ACK response message to the server before normal communication with the server, and the ACK message is sent to the server. The message includes the above target message length.

S407,无线通信模组通过上述基站向服务端发送第一报文段,该第一报文段的长度基于上述目标报文长度确定。S407, the wireless communication module sends a first message segment to the server through the base station, and the length of the first message segment is determined based on the length of the target message.

实施例3:Example 3:

在本申请实施例中,上述客户端包括主机和无线通信模组,上述TCP/IP协议栈配置于所述主机,上述步骤S302中通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据该第三报文长度和该第四报文长度中较小的报文长度确定目标报文长度,包括:所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述第二报文长度;所述无线通信模组接收服务端发送的所述第四报文长度,并与所述第三报文长度比较,确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,所述无线通信模组将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机(也即将篡改后的第四报文长度发送给所述主机)。In the embodiment of the present application, the above-mentioned client includes a host and a wireless communication module, the above-mentioned TCP/IP protocol stack is configured on the above-mentioned host, and in the above-mentioned step S302, the server is obtained through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack The length of the fourth packet sent, and determining the target packet length according to the smaller packet length of the third packet length and the fourth packet length, including: the host passing through the TCP/IP protocol stack based on The wireless communication module sends the second message length to the server; the wireless communication module receives the fourth message length sent by the server, and compares it with the third message length, Determining that the smaller of the third packet length and the fourth packet length is the target packet length; if it is determined that the fourth packet length is not equal to the target packet length , the wireless communication module modifies the fourth message length to the target message length, and sends it to the host (that is, sending the tampered fourth message length to the host).

上述确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机,也可以为:在确定所述第三报文长度小于所述第四报文长度的情况下,无线通信模组将所述第四报文长度篡改为所述第三报文长度,并将篡改后的第四报文长度发送给主机;所述主机接收所述篡改后的第四报文长度,并确定所述篡改后的第四报文长度为所述目标报文长度;在确定所述第三报文长度大于所述第四报文长度的情况下,无线通信模组将所述第四报文长度发送给所述主机;所述主机接收所述第四报文长度,并确定所述第四报文长度为所述目标报文长度。The smaller value of the third packet length and the fourth packet length determined above is the target packet length; when it is determined that the fourth packet length is not equal to the target packet length , the length of the fourth packet is tampered with the length of the target packet, and sent to the host, or it may be: in the case that the length of the third packet is determined to be less than the length of the fourth packet , the wireless communication module tampers with the length of the fourth message to the length of the third message, and sends the length of the fourth message after the tampering to the host; the host receives the length of the fourth message after the tampering length, and determine that the length of the tampered fourth message is the length of the target message; when it is determined that the length of the third message is greater than the length of the fourth message, the wireless communication module will The fourth packet length is sent to the host; the host receives the fourth packet length, and determines that the fourth packet length is the target packet length.

具体的,以下结合图5详细介绍在TCP/IP协议栈配置于无线通信模组的场景下,本申请实施例提供又一种数据通信方法。Specifically, an embodiment of the present application provides another data communication method in a scenario where the TCP/IP protocol stack is configured in the wireless communication module in detail with reference to FIG. 5 .

如图5所示,该数据通信方法包括以下步骤:As shown in Figure 5, the data communication method includes the following steps:

S501,无线通信模组获取基站发送的第一报文长度。S501, the wireless communication module obtains the length of the first packet sent by the base station.

关于无线通信模组具体如何获取第一报文长度的说明可以参照本文其他实施例的相关说明(例如上述步骤S301中客户端获取第一报文长度的相关说明),在此不再详述。For the specific description of how the wireless communication module obtains the first packet length, reference may be made to the relevant descriptions of other embodiments herein (eg, the relevant description of the client acquiring the first packet length in the above step S301 ), which will not be described in detail here.

S502,无线通信模组确定上述第一报文长度和上述第二报文长度中较小的报文长度为第三报文长度。S502, the wireless communication module determines that the smaller one of the first packet length and the second packet length is the third packet length.

在本申请实施例中,上述第二报文长度为客户端期望接收到的报文段的最大数据长度(即客户端的MSS)。In the embodiment of the present application, the above-mentioned second packet length is the maximum data length of the packet segment expected to be received by the client (ie, the MSS of the client).

S503,主机通过无线通信模组向服务端发送上述第二报文长度。S503, the host sends the above-mentioned second message length to the server through the wireless communication module.

在本申请实施例中,上述第二报文长度即为客户端自身期望接收到的报文段的最大数据长度(即客户端自身的MSS)。In the embodiment of the present application, the above-mentioned second packet length is the maximum data length of the packet segment expected to be received by the client (ie, the MSS of the client).

具体的,主机在检测到与服务端进行TCP三次握手的触发指令后,通过该无线通信模组向服务端发送SYN报文以进行TCP三次握手中的第一次握手动作,其中,该SYN中携带上述第二报文长度。Specifically, after the host detects the trigger command for performing the TCP three-way handshake with the server, it sends a SYN message to the server through the wireless communication module to perform the first handshake in the TCP three-way handshake, wherein the SYN Carry the above-mentioned second packet length.

S504,无线通信模组接收服务端发送的第四报文长度。S504, the wireless communication module receives the fourth packet length sent by the server.

在本申请实施例中,第四报文长度即为服务端期望接收到的报文段的最大数据长度(即服务端的MSS)。In the embodiment of the present application, the fourth packet length is the maximum data length of the packet segment expected to be received by the server (ie, the MSS of the server).

具体的,在服务端接收到客户端发送的包含上述第二报文长度的SYN报文后,服务端响应于该SYN报文,向客户端发送响应报文SYN+ACK报文以进行TCP三次握手中的第二次握手,其中该SYN+ACK报文中包括上述第四报文长度。Specifically, after the server receives the SYN message containing the above-mentioned second message length sent by the client, the server responds to the SYN message and sends a response message SYN+ACK message to the client to perform TCP three times. The second handshake in the handshake, wherein the SYN+ACK message includes the above-mentioned fourth message length.

S505,无线通信模组将上述第四报文长度与上述第三报文长度作比较,确定第三报文长度和第四报文长度中的较小值为目标报文长度。S505, the wireless communication module compares the length of the fourth packet with the length of the third packet, and determines that the smaller of the length of the third packet and the length of the fourth packet is the target packet length.

具体的,客户端中的无线通信模组在接收到服务端发送的上述SYN+ACK报文后,解析该SYN+ACK报文得到上述第四报文长度;再将第三报文长度和第四报文长度作比较。并确定第三报文长度和第四报文长度中的较小值为目标报文长度。Specifically, after receiving the above-mentioned SYN+ACK message sent by the server, the wireless communication module in the client parses the SYN+ACK message to obtain the above-mentioned fourth message length; Four packet lengths are compared. And determine the smaller of the third packet length and the fourth packet length as the target packet length.

S506,在确定上述第四报文长度与上述目标报文长度不相等的情况下,无线通信模组将上述第四报文长度篡改成上述目标报文长度,并将篡改后的第四报文长度发送给上述主机。S506, in the case where it is determined that the length of the fourth packet is not equal to the length of the target packet, the wireless communication module tampers with the length of the fourth packet to the length of the target packet, and tampered with the fourth packet The length is sent to the above host.

具体的,无线通信模组解析该SYN+ACK报文得到上述第四报文长度之后,在确定上述第四报文长度与上述目标报文长度不相等的情况下,将上述SYN+ACK报文中的第四报文长度篡改成上述目标报文长度,并将篡改后SYN+ACK报文的发送给上述主机。Specifically, after the wireless communication module parses the SYN+ACK packet to obtain the length of the fourth packet, and determines that the length of the fourth packet is not equal to the length of the target packet, the SYN+ACK packet is The fourth message length in is tampered with the above target message length, and the tampered SYN+ACK message is sent to the above host.

S507,主机通过无线通信模组向服务端发送ACK应答报文。S507, the host sends an ACK response message to the server through the wireless communication module.

在上述步骤S506(无线通信模组将上述第四报文长度篡改成上述目标报文长度,并将篡改后的第四报文长度发送给上述主机)之后,步骤S508(主机通过无线通信模组向服务端发送第一报文段)之前,所述方法还包括:所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述目标报文长度,以使得所述客户端和所述服务端基于所述目标报文长度进行数据通信。After the above-mentioned step S506 (the wireless communication module tampers with the above-mentioned fourth packet length to the above-mentioned target packet length, and sends the tampered fourth packet length to the above-mentioned host), the step S508 (the host through the wireless communication module Before sending the first message segment to the server), the method further includes: the host sends the target message length to the server through the wireless communication module based on the TCP/IP protocol stack, to The client and the server are made to perform data communication based on the target message length.

示例性的,为完成TCP三次握手,以确保客户端和服务端之间的通信为可靠通信,客户端会在与服务端进行正常通信之前,向服务端发送ACK应答报文,且该ACK报文包括上述目标报文长度。Exemplarily, in order to complete the TCP three-way handshake to ensure that the communication between the client and the server is reliable communication, the client sends an ACK response message to the server before normal communication with the server, and the ACK message is sent to the server. The message includes the above target message length.

S508,主机通过无线通信模组向服务端发送第一报文段,该第一报文段的长度基于上述目标报文长度确定。S508, the host sends a first message segment to the server through the wireless communication module, and the length of the first message segment is determined based on the above-mentioned target message length.

可理解的,TCP三次握手中,客户端向服务端发送的报文(例如SYN报文和ACK报文),是由客户端中配置的TCP/IP协议栈中的传输层向客户端中的物理层的无线通信模组发送,再由无线通信模组向服务端发送。若TCP/IP协议栈配置在无线通信模组中(也可以理解为此时客户端与服务端即将进行内置业务),如上述步骤S403所示无线通信模组可以确定TCP/IP协议栈中SYN报文中携带的数据(也即SYN报文中携带上述第三报文长度),无线通信模组可以在进行TCP三次握手的第一次握手向服务端发送上述第三报文长度。或者,如上述步骤S504至S506所示,无线通信模组在与服务端进行第二次握手接收到包含第四报文长度的上述SYN+ACK报文后,若确定第四报文长度大于上述第三报文长度,则将该SYN+ACK报文中包括的报文长度修改为上述第三报文长度。Understandably, in the TCP three-way handshake, the packets (such as SYN packets and ACK packets) sent by the client to the server are sent to the client by the transport layer in the TCP/IP protocol stack configured in the client. The wireless communication module of the physical layer sends it, and then the wireless communication module sends it to the server. If the TCP/IP protocol stack is configured in the wireless communication module (it can also be understood that the client and the server are about to carry out built-in services), as shown in the above step S403, the wireless communication module can determine the SYN in the TCP/IP protocol stack. For the data carried in the message (that is, the SYN message carries the above-mentioned third message length), the wireless communication module can send the above-mentioned third message length to the server during the first handshake of the TCP three-way handshake. Or, as shown in the above steps S504 to S506, after the wireless communication module performs the second handshake with the server and receives the above-mentioned SYN+ACK message containing the fourth message length, if it is determined that the fourth message length is greater than the above-mentioned For the third packet length, the packet length included in the SYN+ACK packet is modified to the above-mentioned third packet length.

若TCP/IP协议栈未配置在无线通信模组中(也可以理解为此时客户端与服务端即将进行外置业务),无线通信模组没有权限修改传输层(也即主机)下发的发送内容,而TCP三次握手协议中约定了在第一次握手中,客户端向服务端发送的报文长度即为上述客户端对应的上述的第二报文长度。从而,如上述步骤S504至S506所示,客户端只有在第二次握手接收到服务端发送的上述第四报文长度后,若确定第四报文长度大于上述第三报文长度,则将该SYN+ACK报文中包括的报文长度修改为上述第三报文长度。If the TCP/IP protocol stack is not configured in the wireless communication module (it can also be understood that the client and the server are about to perform external services), the wireless communication module does not have the right to modify the data sent by the transport layer (that is, the host). The TCP three-way handshake protocol stipulates that in the first handshake, the length of the packet sent by the client to the server is the length of the second packet corresponding to the client. Therefore, as shown in the above steps S504 to S506, only after the client receives the above-mentioned fourth packet length sent by the server in the second handshake, if it is determined that the fourth packet length is greater than the above-mentioned third packet length, it will The message length included in the SYN+ACK message is modified to the above-mentioned third message length.

可理解的,在同一个客户端中不会同时支持上述内置业务(TCP/IP协议栈配置在无线通信模组中)和上述外置业务(TCP/IP协议栈配置在无线通信模组中之外),同一个客户端中要么支持内置业务要么支持外置业务。从而程序设计者可以根据客户端支持的业务类型确定在客户端中配置步骤S401至S407的方法、或者步骤S501至S508的方法中的其中一项。示例性的,程序设计者在确定客户端支持的业务类型为内置业务的情况下,可以只在客户端中配置上述步骤S401至S407所示的方法;或者,也可以只在客户端中配置上述步骤S501至S508所示的方法。示例性的,程序设计者在确定客户端支持的业务类型为外置业务的情况下,可以只在客户端中配置上述步骤S501至S508所示的方法。It is understandable that the above built-in service (the TCP/IP protocol stack is configured in the wireless communication module) and the above-mentioned external service (the TCP/IP protocol stack is configured in the wireless communication module) will not be supported at the same time in the same client. external), either built-in services or external services are supported in the same client. Therefore, the programmer can determine to configure one of the methods of steps S401 to S407 or the methods of steps S501 to S508 in the client according to the service type supported by the client. Exemplarily, when the programmer determines that the type of service supported by the client is a built-in service, the method shown in the above steps S401 to S407 may only be configured in the client; or, the above may be configured only in the client. The methods shown in steps S501 to S508. Exemplarily, when the program designer determines that the type of service supported by the client is an external service, the method shown in the above steps S501 to S508 may only be configured in the client.

实施例4:Example 4:

可选的,在一些实现方式中,在上述步骤S302(通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据该第三报文长度和该第四报文长度中较小的报文长度确定目标报文长度)之前,本申请提供的数据通信方法还包括:确定客户端中配置的传输控制协议/网络互联协议TCP/IP协议栈是否位于无线通信模组中;上述步骤S302,具体包括:在确定客户端中配置的上述TCP/IP协议栈位于上述无线通信模组中的情况下,所述无线通信模组通过所述TCP/IP协议栈向所述服务端发送所述第三报文长度;所述无线通信模组通过所述TCP/IP协议栈接收所述服务端发送的所述第四报文长度;所述无线通信模组确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度。在确定上述客户端中配置的上述TCP/IP协议栈不位于上述无线通信模组的情况下,所述主机基于所述TCP/IP协议栈通过所述无线通信模组向所述服务端发送所述第二报文长度;所述无线通信模组接收服务端发送的所述第四报文长度,并与所述第三报文长度比较,确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,所述无线通信模组将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机。Optionally, in some implementations, in the above step S302 (obtaining the fourth message length sent by the server through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and according to the third message length and the Before determining the target message length with the smaller message length among the four message lengths), the data communication method provided by the present application further includes: determining whether the transmission control protocol/network interconnection protocol TCP/IP protocol stack configured in the client is located in the wireless In the communication module; the above-mentioned step S302 specifically includes: when it is determined that the above-mentioned TCP/IP protocol stack configured in the client is located in the above-mentioned wireless communication module, the wireless communication module passes the TCP/IP protocol stack. sending the third message length to the server; the wireless communication module receives the fourth message length sent by the server through the TCP/IP protocol stack; the wireless communication module determines The smaller packet length of the third packet length and the fourth packet length is the target packet length. In the case where it is determined that the TCP/IP protocol stack configured in the client is not located in the wireless communication module, the host sends the information to the server through the wireless communication module based on the TCP/IP protocol stack. the length of the second message; the wireless communication module receives the length of the fourth message sent by the server, and compares it with the length of the third message to determine the length of the third message and the length of the fourth message The smaller value of the message length is the target message length; when it is determined that the fourth message length is not equal to the target message length, the wireless communication module sends the fourth message length to the target message length. The length of the message is tampered with the length of the target message, and sent to the host.

也就是说,也可以在一个客户端中同时配置有上述步骤S401至S407和上述步骤S501至S508所示的方法的核心处理流程。That is to say, the core processing flow of the methods shown in the above steps S401 to S407 and the above steps S501 to S508 may also be configured in one client at the same time.

具体的,在上述步骤S401或S501之后,S402或S502之前,还包括:确定客户端支持的业务类型;在确定客户端支持的业务类型为内置业务的情况下,客户端执行步骤S402至S407;在确定客户端支持的业务类型为外置业务的情况下,客户端执行步骤S502至S508。Specifically, after the above step S401 or S501 and before S402 or S502, the method further includes: determining the type of service supported by the client; when it is determined that the type of service supported by the client is a built-in service, the client executes steps S402 to S407; When it is determined that the service type supported by the client is an external service, the client executes steps S502 to S508.

具体的,以下以第一报文长度为上述第一报文长度、第二报文长度以及第四报文长度中的最小报文长度为例,结合图6详细介绍本申请实施例提供又一种数据通信方法。Specifically, in the following, taking the first packet length as the minimum packet length among the above-mentioned first packet length, second packet length, and fourth packet length as an example, the embodiments of the present application are described in detail with reference to FIG. 6 to provide yet another method. a data communication method.

关于第一报文长度、第二报文长度以及第四报文长度的详细说明可以参照本文其他实施例的相关描述,在此不再详述。For a detailed description of the first packet length, the second packet length, and the fourth packet length, reference may be made to the related descriptions of other embodiments herein, which are not described in detail here.

如图6所示,该数据通信方法包括以下步骤:As shown in Figure 6, the data communication method includes the following steps:

S601,客户端接收分组数据网PDN数据包。S601, the client receives the packet data network PDN data packet.

关于PDN数据包的描述可以参照本文其他实施例的相关说明(例如实施例1关于PDN容器的相关说明),在此不再详述。For the description of the PDN data packet, reference may be made to the relevant descriptions of other embodiments in this document (for example, the relevant descriptions of the PDN container in Embodiment 1), which will not be described in detail here.

S602,客户端解析PDN数据包得到协议配置选项PCO中的MTU字段。S602, the client parses the PDN data packet to obtain the MTU field in the protocol configuration option PCO.

关于PCO中的MTU字段的描述可以参照本文其他实施例的相关说明(例如实施例1关于PCO中的MTU字段的相关说明),在此不再详述。For the description of the MTU field in the PCO, reference may be made to the relevant descriptions of other embodiments in this document (for example, the relevant description of the MTU field in the PCO in Embodiment 1), which will not be described in detail here.

S603,客户端根据该MTU字段计算得到第一MSS。S603, the client calculates and obtains the first MSS according to the MTU field.

S604,客户端确定自身支持的业务类型。S604, the client determines the service type supported by itself.

S605,在确定客户端支持的业务类型为内置业务的情况下,客户端使用计算得到的上述第一MSS进行三次握手。S605, in the case where it is determined that the service type supported by the client is a built-in service, the client performs a three-way handshake using the above-mentioned first MSS obtained by calculation.

在本申请实施例中,第一报文长度小于上述客户端中的第二报文长度,在确定客户端支持的业务类型为内置业务的情况下,客户端使用上述MTU计算得到的上述第一MSS(也即第一报文长度)进行三次握手中的第一次握手。也可以理解为,在确定客户端支持的业务类型为内置业务的情况下,客户端执行上述步骤S402至S407。In this embodiment of the present application, the length of the first packet is smaller than the length of the second packet in the client, and when it is determined that the service type supported by the client is a built-in service, the client uses the MTU to calculate the first The MSS (that is, the first packet length) performs the first handshake in the three-way handshake. It can also be understood that, in the case where it is determined that the service type supported by the client is a built-in service, the client performs the above steps S402 to S407.

S606,在确定客户端支持的业务类型的外置业务的情况下,客户端监听SYN+ACK报文,将TCP协商时服务端携带的MSS篡改为上述第一MSS。S606, in the case of determining the external service of the service type supported by the client, the client monitors the SYN+ACK message, and changes the MSS carried by the server during the TCP negotiation to the above-mentioned first MSS.

在本申请实施例中,第一报文长度小于上述服务端中的第二报文长度,在确定客户端支持的业务类型为内置业务的情况下,客户端监听SYN+ACK报文,将TCP协商时对方携带的MSS篡改为上述第一MSS。也可以理解为,在确定客户端支持的业务类型为外置业务的情况下,客户端执行上述步骤S502至S507。In the embodiment of the present application, the length of the first packet is smaller than the length of the second packet in the above-mentioned server, and in the case that the service type supported by the client is determined to be a built-in service, the client monitors the SYN+ACK packet, and the TCP During negotiation, the MSS carried by the other party is tampered with the above-mentioned first MSS. It can also be understood that, in the case where it is determined that the service type supported by the client terminal is an external service, the client terminal performs the above steps S502 to S507.

S607,客户端使用上述第一MSS向服务端发送数据。S607, the client sends data to the server by using the first MSS.

在本申请实施例中,第一报文长度为上述第一报文长度、第二报文长度以及第三报文长度中的最小报文长度,客户端向服务端发送的第一报文段的长度基于上述第一MSS(也可以理解为其他实施例所描述的目标报文长度)确定。In this embodiment of the present application, the first packet length is the minimum packet length among the above-mentioned first packet length, second packet length, and third packet length, and the first packet segment sent by the client to the server The length of is determined based on the above-mentioned first MSS (which can also be understood as the length of the target message described in other embodiments).

以下将介绍本发明实施例提供的数据通信装置。The data communication apparatus provided by the embodiments of the present invention will be introduced below.

请参见图7,为本发明实施例提供了一种数据通信装置的结构示意图。如图7所示,本发明实施例的数据通信装置可以包括:Please refer to FIG. 7 , which is a schematic structural diagram of a data communication apparatus according to an embodiment of the present invention. As shown in FIG. 7 , the data communication apparatus according to the embodiment of the present invention may include:

第一确定单元701,用于获取基站发送的第一报文长度,并确定上述第一报文长度和第二报文长度中较小的报文长度为第三报文长度;其中,上述第一报文长度为运营商网络确定的最大数据长度,上述第二报文长度为上述客户端期望接收到的报文段的最大数据长度;The first determining unit 701 is configured to obtain the length of the first message sent by the base station, and determine the smaller message length of the first message length and the second message length as the third message length; One message length is the maximum data length determined by the operator network, and the above-mentioned second message length is the maximum data length of the message segment that the above-mentioned client expects to receive;

第二确定单元702,用于通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据上述第三报文长度和上述第四报文长度中较小的报文长度确定目标报文长度;其中,上述第四报文长度为上述服务端期望接收到的报文段的最大数据长度;The second determining unit 702 is configured to obtain the length of the fourth packet sent by the server through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and determine the length of the fourth packet according to the smaller of the length of the third packet and the length of the fourth packet. The message length determines the target message length; wherein, the above-mentioned fourth message length is the maximum data length of the message segment that the above-mentioned server expects to receive;

收发单元703,用于通过上述基站向上述服务端发送第一报文段,上述第一报文段的长度基于上述目标报文长度确定。The transceiver unit 703 is configured to send a first segment to the server through the base station, where the length of the first segment is determined based on the length of the target message.

在一种可能的实现方式中,上述第二确定单元702,具体用于基于TCP/IP协议栈通过收发单元703向所述服务端发送所述第三报文长度;通过收发单元703接收所述服务端发送的所述第四报文长度,以及,确定所述第三报文长度和所述第四报文长度中较小的报文长度为所述目标报文长度。In a possible implementation manner, the above-mentioned second determining unit 702 is specifically configured to send the third packet length to the server through the transceiver unit 703 based on the TCP/IP protocol stack; receive the third packet length through the transceiver unit 703 The fourth packet length sent by the server, and determining the smaller packet length of the third packet length and the fourth packet length as the target packet length.

在一种可能的实现方式中,上述收发单元703还用于通过所述TCP/IP协议栈向所述服务端发送所述目标报文长度,以使得所述客户端和所述服务端基于所述目标报文长度进行数据通信。In a possible implementation manner, the above-mentioned transceiver unit 703 is further configured to send the target packet length to the server through the TCP/IP protocol stack, so that the client and the server are based on the The target message length is specified for data communication.

在一种可能的实现方式中,上述第二确定单元702,具体用于基于所述TCP/IP协议栈通过收发单元703向所述服务端发送所述第二报文长度;通过收发单元703接收服务端发送的所述第四报文长度;以及与所述第三报文长度比较,并确定所述第三报文长度和所述第四报文长度中的较小值为所述目标报文长度;在确定所述第四报文长度与所述目标报文长度不相等的情况下,将所述第四报文长度篡改成所述目标报文长度,并发送给所述主机。In a possible implementation manner, the above-mentioned second determining unit 702 is specifically configured to send the second packet length to the server through the transceiver unit 703 based on the TCP/IP protocol stack; receive through the transceiver unit 703 the length of the fourth message sent by the server; and comparing with the length of the third message, and determining that the smaller of the length of the third message and the length of the fourth message is the target message message length; in the case that it is determined that the length of the fourth message is not equal to the length of the target message, the length of the fourth message is tampered with the length of the target message, and sent to the host.

在一种可能的实现方式中,如图8所示,上述第一确定单元701具体用于获取上述基站发送的第一最大传输单元MTU,按照公式“第一报文长度=第一最大传输单元MTU-IP首部长度-TCP首部长度”计算上述第一报文长度。In a possible implementation manner, as shown in FIG. 8 , the above-mentioned first determining unit 701 is specifically configured to obtain the first maximum transmission unit MTU sent by the above-mentioned base station, according to the formula “first packet length=first maximum transmission unit MTU-IP Header Length-TCP Header Length" calculates the above-mentioned first packet length.

在一种可能的实现方式中,上述第一确定单元701,具体用于在上述客户端驻网时,接收上述基站发送的分组数据网PDN数据包。In a possible implementation manner, the above-mentioned first determining unit 701 is specifically configured to receive the packet data network PDN data packet sent by the above-mentioned base station when the above-mentioned client terminal resides on the network.

关于第一MTU、IP首部长度、TCP首部长度以及PDN数据包等名词的解释可以参照本文其他实施例的相关说明,在此不再详述。For the explanation of terms such as the first MTU, the length of the IP header, the length of the TCP header, and the PDN data packet, reference may be made to the related descriptions of other embodiments in this document, which will not be described in detail here.

需要说明的是,具体执行过程可以参见图3至图6所示的方法实施例的具体说明,在此不进行赘述。It should be noted that, for the specific execution process, reference may be made to the specific descriptions of the method embodiments shown in FIG. 3 to FIG. 6 , which will not be repeated here.

可理解的,上述图7所示的数据通信装置可以有多种产品形态。示例性的,数据通信装置还可以是如图8所示的处理器、通信接口、存储器以及通信总线的数据通信装置。具体的,如图8所示,数据通信装置80可以包括:It is understandable that the data communication device shown in FIG. 7 can have various product forms. Exemplarily, the data communication apparatus may also be a data communication apparatus of a processor, a communication interface, a memory, and a communication bus as shown in FIG. 8 . Specifically, as shown in FIG. 8 , the data communication device 80 may include:

至少一个处理器801,例如CPU,至少一个通信接口803,存储器804,至少一个通信总线802。其中,通信总线802用于实现这些组件之间的连接通信。通信接口803可选的可以包括标准的有线接口、无线接口(如WI-FI接口或蓝牙接口等)。存储器804可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。存储器804可选的还可以是至少一个位于远离前述处理器801的存储装置。如图8所示,作为一种计算机存储介质的存储器804中可以包括操作系统和程序指令。At least one processor 801 , eg a CPU, at least one communication interface 803 , memory 804 , at least one communication bus 802 . Among them, the communication bus 802 is used to realize the connection and communication between these components. Optionally, the communication interface 803 may include a standard wired interface, a wireless interface (such as a WI-FI interface or a Bluetooth interface, etc.). The memory 804 may be high-speed RAM memory or non-volatile memory, such as at least one disk memory. The memory 804 can optionally also be at least one storage device located away from the aforementioned processor 801 . As shown in FIG. 8, the memory 804, which is a computer storage medium, may include an operating system and program instructions.

示例性的,处理器801,可以用于实现上述第一确定单元701、第二确定单元702等执行的步骤或功能。通信接口803,可以用于实现收发单元703执行的步骤或功能等。示例性的,该通信接口803对应可以为芯片中的管脚,也可以是收发器。Exemplarily, the processor 801 may be configured to implement the steps or functions performed by the first determining unit 701, the second determining unit 702, and the like. The communication interface 803 may be used to implement steps or functions performed by the transceiver unit 703 . Exemplarily, the communication interface 803 may correspond to a pin in a chip or a transceiver.

例如,由上述通信接口803接收基站发送的上述第一MTU,并由该通信接口803将上述第一MTU发送给处理器801,由处理器801根据公式计算得到上述第一报文长度的值。For example, the above-mentioned first MTU sent by the base station is received by the above-mentioned communication interface 803, and the above-mentioned first MTU is sent by the above-mentioned communication interface 803 to the processor 801, and the processor 801 calculates the value of the above-mentioned first packet length according to the formula.

在本申请实施例中,客户端包括主机和无线通信模组。In this embodiment of the present application, the client includes a host and a wireless communication module.

在TCP/IP协议栈配置于所述无线通信模组中的场景,该无线通信模组中可以包括上述处理器801和上述通信接口803;该无线通信模组中还可以包括一个或多个存储器;该主机中可以包括处理器和一个或多个存储器,本文对此不做限定。In the scenario where the TCP/IP protocol stack is configured in the wireless communication module, the wireless communication module may include the above-mentioned processor 801 and the above-mentioned communication interface 803; the wireless communication module may also include one or more memories ; The host may include a processor and one or more memories, which are not limited herein.

在TCP/IP协议栈未配置于所述无线通信模组中的场景,上述主机中可以包括上述处理器801和一个或多个存储器;无线通信模组中可以不包括处理器,无线通信模组中可以包括上述通信接口803以及一个或多个存储器。In the scenario where the TCP/IP protocol stack is not configured in the wireless communication module, the above-mentioned host may include the above-mentioned processor 801 and one or more memories; the wireless communication module may not include a processor, and the wireless communication module The above-mentioned communication interface 803 and one or more memories may be included.

在图8所示的数据通信装置80中,处理器801可以用于加载存储器804中存储的程序指令,并具体执行以下操作:In the data communication device 80 shown in FIG. 8 , the processor 801 may be configured to load the program instructions stored in the memory 804, and specifically perform the following operations:

获取基站发送的第一报文长度,并确定上述第一报文长度和第二报文长度中较小的报文长度为第三报文长度;其中,上述第一报文长度为运营商网络确定的最大数据长度,上述第二报文长度为上述客户端期望接收到的报文段的最大数据长度;Obtain the length of the first packet sent by the base station, and determine that the smaller of the first packet length and the second packet length is the third packet length; wherein the first packet length is the operator network The determined maximum data length, the above-mentioned second message length is the maximum data length of the message segment that the above-mentioned client expects to receive;

通过传输控制协议/网络互联协议TCP/IP协议栈获取服务端发送的第四报文长度,并根据上述第三报文长度和上述第四报文长度中较小的报文长度确定目标报文长度;其中,上述第四报文长度为上述服务端期望接收到的报文段的最大数据长度;Obtain the length of the fourth packet sent by the server through the Transmission Control Protocol/Internet Protocol TCP/IP protocol stack, and determine the target packet according to the smaller of the length of the third packet and the length of the fourth packet. Length; wherein, the above-mentioned fourth message length is the maximum data length of the message segment that the above-mentioned server expects to receive;

通过上述基站向上述服务端发送第一报文段,上述第一报文段的长度基于上述目标报文长度确定。The base station sends the first message segment to the server, and the length of the first message segment is determined based on the length of the target message.

需要说明的是,具体执行过程可以参见图3至图6所示的实施例的具体说明,在此不进行赘述。It should be noted that, for the specific execution process, reference may be made to the specific descriptions of the embodiments shown in FIG. 3 to FIG. 6 , which will not be repeated here.

本发明实施例还提供了一种计算机存储介质,上述计算机存储介质可以存储有多条指令,上述指令适于由处理器加载并执行如上述图3至图6所示的实施例的方法步骤,具体执行过程可以参见图3至图6所示实施例的具体说明,在此不进行赘述。An embodiment of the present invention further provides a computer storage medium, where the computer storage medium can store a plurality of instructions, and the above-mentioned instructions are suitable for being loaded by a processor and executing the method steps of the above-mentioned embodiments shown in FIG. 3 to FIG. 6 , For the specific execution process, reference may be made to the specific descriptions of the embodiments shown in FIG. 3 to FIG. 6 , which will not be repeated here.

上述实施例中所用,根据上下文,术语“当…时”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。As used in the above embodiments, the term "when" may be interpreted to mean "if" or "after" or "in response to determining..." or "in response to detecting..." depending on the context. Similarly, depending on the context, the phrases "in determining..." or "if detecting (the stated condition or event)" can be interpreted to mean "if determining..." or "in response to determining..." or "on detecting (the stated condition or event)" or "in response to the detection of (the stated condition or event)".

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务端或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务端或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务端、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can 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. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to 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 can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center through Transmission to another website site, computer, server or data center by wired (eg coaxial cable, optical fiber, digital subscriber line) or wireless (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, etc. that includes one or more available media integrated. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented. The process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed , which may include the processes of the foregoing method embodiments. The aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Claims (10)

1. A data communication method, applied to a client, wherein the client is wirelessly connected to a server through a base station, the method comprising:
acquiring a first message length sent by the base station, and determining the smaller message length in the first message length and the second message length as a third message length; the first message length is the maximum data length determined by an operator network, and the second message length is the maximum data length of a message segment expected to be received by the client;
acquiring a fourth message length sent by the server through a transmission control protocol/internet protocol (TCP/IP) stack, and determining a target message length according to the smaller message length of the third message length and the fourth message length; the fourth message length is the maximum data length of a message segment expected to be received by the server;
and sending a first message segment to the server through the base station, wherein the length of the first message segment is determined based on the target message length.
2. The method according to claim 1, wherein the client includes a host and a wireless communication module, the TCP/IP protocol stack is configured in the wireless communication module, and the obtaining a fourth packet length sent by the server through a TCP/IP protocol stack and determining a target packet length according to a smaller packet length of the third packet length and the fourth packet length includes:
the wireless communication module sends the third message length to the server through the TCP/IP protocol stack;
the wireless communication module receives the length of the fourth message sent by the server through the TCP/IP protocol stack;
and the wireless communication module determines the smaller message length in the third message length and the fourth message length as the target message length.
3. The method of claim 2, wherein after the wireless communication module determines that the smaller of the third packet length and the fourth packet length is the target packet length, before the first segment is sent to the server through the base station, the method further comprises:
and the wireless communication module sends the target message length to the server through the TCP/IP protocol stack, so that the client and the server perform data communication based on the target message length.
4. The method according to claim 1, wherein the client includes a host and a wireless communication module, the TCP/IP protocol stack is configured in the host, the obtaining a fourth packet length sent by the server through a TCP/IP protocol stack according to a transmission control protocol/internet protocol, and determining a target packet length according to a smaller packet length of the third packet length and the fourth packet length includes:
the host sends the second message length to the server through the wireless communication module based on the TCP/IP protocol stack;
the wireless communication module receives the length of the fourth message sent by the server, compares the length of the fourth message with the length of the third message, and determines the smaller value of the length of the third message and the length of the fourth message as the length of the target message;
and under the condition that the fourth message length is determined to be unequal to the target message length, the wireless communication module is used for modifying the fourth message length into the target message length and sending the target message length to the host.
5. The method of claim 4, wherein after the tampering the fourth packet length to the target packet length and sending the tamped fourth packet length to the host, before sending, by the base station, the first segment to the server, the method further comprises:
and the host sends the target message length to the server through the wireless communication module based on the TCP/IP protocol stack, so that the client and the server perform data communication based on the target message length.
6. The method according to any of claims 1-5, wherein said obtaining the first message length sent by the base station comprises:
acquiring a first Maximum Transmission Unit (MTU) sent by the base station, and calculating the first message length according to a formula of the first message length which is the first maximum transmission unit (MTU-IP) header length-TCP header length; wherein the first MTU is determined by the operator network, and the IP header length and the TCP header length are an IP header length and a TCP header length, respectively, corresponding to a network protocol version configured in the client.
7. The method of claim 6, wherein the obtaining the first MTU sent by the base station comprises:
and when the client side is resident in the network, receiving a Packet Data Network (PDN) data packet sent by the base station, wherein the PDN data packet comprises the first MTU.
8. A data communication apparatus, comprising:
a first determining unit, configured to obtain a first message length sent by the base station, and determine a smaller message length of the first message length and the second message length as a third message length; the first message length is the maximum data length determined by an operator network, and the second message length is the maximum data length expected to be received by the client;
a second determining unit, configured to obtain a fourth packet length sent by the server through a TCP/IP stack, and determine a target packet length according to a smaller packet length of the third packet length and the fourth packet length; the fourth message length is the maximum data length of a message segment expected to be received by the server;
and the receiving and sending unit is used for sending a first message segment to the server through the base station, and the length of the first message segment is determined based on the length of the target message.
9. An electronic device, comprising: a memory, a processor, wherein the memory stores program instructions; the program instructions, when executed by the processor, cause the processor to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium; the computer program, when run on one or more processors, performs the method of any one of claims 1-7.
CN202210254784.5A 2022-03-15 2022-03-15 A data communication method and related device Pending CN114599089A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210254784.5A CN114599089A (en) 2022-03-15 2022-03-15 A data communication method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210254784.5A CN114599089A (en) 2022-03-15 2022-03-15 A data communication method and related device

Publications (1)

Publication Number Publication Date
CN114599089A true CN114599089A (en) 2022-06-07

Family

ID=81809090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210254784.5A Pending CN114599089A (en) 2022-03-15 2022-03-15 A data communication method and related device

Country Status (1)

Country Link
CN (1) CN114599089A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101547146A (en) * 2009-04-24 2009-09-30 上海华为技术有限公司 Method and network equipment for determining length value of maximum message segment
WO2017219813A1 (en) * 2016-06-23 2017-12-28 华为技术有限公司 Traffic processing method and transparent buffer system
US20200137798A1 (en) * 2018-02-15 2020-04-30 Telefonaktiebolaget Lm Ericsson (Publ) Wireless Device, Network Node, and Methods Performed Thereby
CN111163037A (en) * 2018-11-07 2020-05-15 大唐移动通信设备有限公司 IP fragmentation optimization method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101547146A (en) * 2009-04-24 2009-09-30 上海华为技术有限公司 Method and network equipment for determining length value of maximum message segment
WO2017219813A1 (en) * 2016-06-23 2017-12-28 华为技术有限公司 Traffic processing method and transparent buffer system
US20200137798A1 (en) * 2018-02-15 2020-04-30 Telefonaktiebolaget Lm Ericsson (Publ) Wireless Device, Network Node, and Methods Performed Thereby
CN111163037A (en) * 2018-11-07 2020-05-15 大唐移动通信设备有限公司 IP fragmentation optimization method and device

Similar Documents

Publication Publication Date Title
US11330469B2 (en) Increasing access point throughput by exceeding A-MPDU buffer size limitation in a 802.11 compliant station
CN106464602B (en) Method for obtaining MTU size by using AT command and terminal equipment
CN110999257B (en) Delivery method selection for delivery of server notifications
KR101594958B1 (en) Systems and method for reduced power wireless communication
US20230028723A1 (en) Communications Network
JP7645333B2 (en) Terminal device, communication method, and base station device
US9949300B2 (en) Packet transmission method and system, and station
US8477683B2 (en) Configuring a host device by way of MMP
WO2016154831A1 (en) Method and device for realizing transmission control protocol (tcp) transmission
CN114599089A (en) A data communication method and related device
WO2023173876A1 (en) Data communication method and apparatus, device and medium
CN114365470B (en) Method and device for transmitting Ethernet compressed packets
CN114846774B (en) Communication method and device
WO2022027341A1 (en) Wireless communication method and terminal device
AU2022470393A1 (en) Method, device, and system for congestion control in wireless networks
TWI823362B (en) A communication method and device,storage medium and chip system
CN114342462B (en) Wireless communication method and device
WO2023011006A1 (en) Communication method and apparatus, and device
JP2020077928A (en) Terminal device, base station device, method, and integrated circuit
WO2024140801A1 (en) Data transmission method, apparatus and system
WO2022222474A1 (en) Packet processing method and apparatus, system, device, and computer-readable storage medium
WO2024027299A1 (en) Message routing method and device
WO2025067184A1 (en) Communication method and apparatus
CN114698145A (en) Method and device for transmitting data
CN111491336A (en) Method and equipment for configuring QoS (quality of service) and transmitting data

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