Data transmission method and device

文档序号:1508530 发布日期:2020-02-07 浏览:11次 中文

阅读说明:本技术 数据传输方法和装置 (Data transmission method and device ) 是由 龙宇锋 史鑫 王艳辉 杨春晖 于 2018-07-25 设计创作,主要内容包括:本发明提供了一种数据传输方法及装置。其中方法包括:第一终端将待发送的数据划分为不同类型的业务数据,并为每种类型的业务数据创建发送线程,以及为每个发送线程分配优先级;所述第一终端检测当前的网络是否处于拥塞状态;若是,则按照优先级从低到高的顺序关闭当前开启的优先级最低的发送线程;若否,则在确定存在关闭的发送线程后,按照优先级从高到低的顺序开启当前关闭的优先级最高的发送线程;所述第一终端将当前开启的发送线程的业务数据发送至第二终端。本发明能够避免出现高优先级的业务数据传输延时较大、甚至丢失的情况,提升用户体验。(The invention provides a data transmission method and device. The method comprises the following steps: the method comprises the steps that a first terminal divides data to be sent into different types of service data, creates sending threads for each type of service data, and distributes priority for each sending thread; the first terminal detects whether the current network is in a congestion state; if so, closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority; if not, after the existence of the closed sending thread is determined, opening the sending thread with the highest priority which is closed at present according to the sequence from high priority to low priority; and the first terminal sends the service data of the currently started sending thread to the second terminal. The invention can avoid the condition that the transmission time delay of the high-priority service data is longer, even lost, and improve the user experience.)

1. A method of data transmission, the method comprising:

the method comprises the steps that a first terminal divides data to be sent into different types of service data, creates sending threads for each type of service data, and distributes priority for each sending thread;

the first terminal detects whether the current network is in a congestion state;

if so, closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority;

if not, after the existence of the closed sending thread is determined, opening the sending thread with the highest priority which is closed at present according to the sequence from high priority to low priority;

and the first terminal sends the service data of the currently started sending thread to the second terminal.

2. The method of claim 1,

after the steps of dividing data to be transmitted into different types of service data, creating a transmission thread for each type of service data, and assigning a priority to each transmission thread, the method further includes:

the first terminal calculates the packet size and divides the service data into service data packets according to the packet size;

the step that the first terminal sends the service data of the currently started sending thread to the second terminal comprises the following steps:

and the first terminal sends each service data packet of the currently started sending thread to the second terminal.

3. The method according to claim 2, further comprising, after the step of turning off the currently turned-on lowest priority sending thread in order of priority from low to high:

and reducing the size of the service data packet of at least one currently opened sending thread according to the sequence of the priority from high to low.

4. The method of claim 3, further comprising, after the step of turning on a currently turned-off sending thread with highest priority in order of priority from high to low after determining that there is a turned-off sending thread, the step of:

and restoring the size of the service data packet of at least one sending thread which is currently opened and the size of the service data packet of which is reduced according to the sequence from low priority to high priority.

5. The method according to claim 1, further comprising, after the step of turning off the currently turned-on lowest priority sending thread in order of priority from low to high:

and determining whether to discard the business data of the closed sending thread according to the type of the business data of the closed sending thread and/or the priority of the closed sending thread.

6. The method of claim 1, further comprising, prior to the step of turning on the currently turned-off highest priority sending thread in order of priority from high to low:

the first terminal detects whether the current network is in a congestion state;

and if not, executing the step of opening the currently closed sending thread with the highest priority according to the sequence from high priority to low priority.

7. A data transmission apparatus, characterized in that the apparatus comprises a first terminal, the first terminal comprising:

the creating module is used for dividing data to be sent into different types of service data, creating a sending thread for each type of service data, and distributing priority for each sending thread;

the detection module is used for detecting whether the current network is in a congestion state;

the closing module is used for closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority if the detection module detects that the sending thread is positive;

the starting module is used for starting the currently closed sending thread with the highest priority according to the sequence of the priorities from high to low after determining that the closed sending thread exists if the detection of the detection module is negative;

and the sending module is used for sending the service data of the currently started sending thread to the second terminal.

8. The apparatus of claim 7, wherein the first terminal further comprises:

the sub-packaging module is used for calculating the sub-packaging size and dividing the service data into service data packets according to the sub-packaging size;

the generating module is specifically configured to send each service data packet of the currently started sending thread to the second terminal.

9. The apparatus of claim 8, wherein the first terminal further comprises:

and the reducing module is used for reducing the size of the service data packet of at least one currently opened sending thread according to the sequence from high to low after the closing module closes the currently opened sending thread with the lowest priority according to the sequence from low to high.

10. The method of claim 9, wherein the first terminal further comprises:

and the recovery module is used for recovering the size of at least one service data packet of the sending thread which is currently opened and has the reduced size of the service data packet according to the sequence from low to high after the opening module determines that the closed sending thread exists and opens the sending thread with the highest priority which is currently closed according to the sequence from high to low.

Technical Field

The present invention relates to the field of data processing technologies, and in particular, to a data transmission method and a data transmission apparatus.

Background

With the rapid development of network technologies, bidirectional communications such as video conferences and video teaching are widely popularized in the aspects of life, work, learning and the like of users. In the terminal communication process, the sender terminal sends the acquired external data to the server, and then the server sends the external data to the receiver terminal.

However, network congestion may occur during the transmission of data for some reason. Under the condition of network congestion, the transmission delay of some important data is larger and even lost, so that the phenomena of playing card pause, quick playing after card pause and the like occur at a receiving party terminal, and the user experience is reduced.

Disclosure of Invention

In view of the above problems, embodiments of the present invention are proposed to provide a data transmission method and a corresponding data transmission apparatus that overcome or at least partially solve the above problems.

In order to solve the above problem, an embodiment of the present invention discloses a data transmission method, where the method includes:

the method comprises the steps that a first terminal divides data to be sent into different types of service data, creates sending threads for each type of service data, and distributes priority for each sending thread;

the first terminal detects whether the current network is in a congestion state;

if so, closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority;

if not, after the existence of the closed sending thread is determined, opening the sending thread with the highest priority which is closed at present according to the sequence from high priority to low priority;

and the first terminal sends the service data of the currently started sending thread to the second terminal.

Preferably, after the steps of dividing, by the first terminal, data to be transmitted into different types of service data, creating a transmission thread for each type of service data, and assigning a priority to each transmission thread, the method further includes: the first terminal calculates the packet size and divides the service data into service data packets according to the packet size; the step that the first terminal sends the service data of the currently started sending thread to the second terminal comprises the following steps: and the first terminal sends each service data packet of the currently started sending thread to the second terminal.

Preferably, after the step of turning off the currently turned on sending thread with the lowest priority in the order from low priority to high priority, the method further includes: and reducing the size of the service data packet of at least one currently opened sending thread according to the sequence of the priority from high to low.

Preferably, after the step of turning on the currently turned-off sending thread with the highest priority in order from high priority to low priority after determining that the turned-off sending thread exists, the method further includes: and restoring the size of the service data packet of at least one sending thread which is currently opened and the size of the service data packet of which is reduced according to the sequence from low priority to high priority.

Preferably, after the step of turning off the currently turned on sending thread with the lowest priority in the order from low priority to high priority, the method further includes: and determining whether to discard the business data of the closed sending thread according to the type of the business data of the closed sending thread and/or the priority of the closed sending thread.

Preferably, before the step of turning on the currently turned-off sending thread with the highest priority in the order from high priority to low priority, the method further includes: the first terminal detects whether the current network is in a congestion state; and if not, executing the step of opening the currently closed sending thread with the highest priority according to the sequence from high priority to low priority.

On the other hand, the embodiment of the invention also discloses a data transmission device, which comprises a first terminal, wherein the first terminal comprises:

the creating module is used for dividing data to be sent into different types of service data, creating a sending thread for each type of service data, and distributing priority for each sending thread;

the detection module is used for detecting whether the current network is in a congestion state;

the closing module is used for closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority if the detection module detects that the sending thread is positive;

the starting module is used for starting the currently closed sending thread with the highest priority according to the sequence of the priorities from high to low after determining that the closed sending thread exists if the detection of the detection module is negative;

and the sending module is used for sending the service data of the currently started sending thread to the second terminal.

Preferably, the first terminal further includes: the sub-packaging module is used for calculating the sub-packaging size and dividing the service data into service data packets according to the sub-packaging size; the generating module is specifically configured to send each service data packet of the currently started sending thread to the second terminal.

Preferably, the first terminal further includes: and the reducing module is used for reducing the size of the service data packet of at least one currently opened sending thread according to the sequence from high priority to low priority after the closing module closes the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority.

Preferably, the first terminal further includes: and the recovery module is used for recovering the size of at least one service data packet of the sending thread which is currently opened and has the reduced size of the service data packet according to the sequence from low to high after the opening module determines that the closed sending thread exists and opens the sending thread with the highest priority which is currently closed according to the sequence from high to low.

In the embodiment of the invention, a first terminal divides data to be sent into different types of service data, creates a sending thread for each type of service data, and distributes priority to each sending thread according to a preset mode; the method comprises the steps that a first terminal detects whether a current network is in a congestion state; if so, closing the currently opened sending thread with the lowest priority according to the sequence from low priority to high priority; if not, after the existence of the closed sending thread is determined, opening the sending thread with the highest priority which is closed at present according to the sequence from high priority to low priority; and the first terminal sends the service data of the currently started sending thread to the second terminal. Therefore, different priorities can be set according to the types of the service data, and when the network is congested, the sending of the service data with low priority can be suspended, so that the service data with high priority can be smoothly sent, the condition that the transmission delay of the service data with high priority is large and even lost is avoided, and the phenomena of pause playing, fast playing after pause and the like of a receiving party terminal are avoided; and after the network is not congested, the service data with the low priority which is suspended before is continuously sent, so that the data with the low priority can be timely sent again, and the user experience can be improved.

Drawings

FIG. 1 is a schematic networking diagram of a video network of the present invention;

FIG. 2 is a schematic diagram of a hardware architecture of a node server according to the present invention;

fig. 3 is a schematic diagram of a hardware structure of an access switch of the present invention;

fig. 4 is a schematic diagram of a hardware structure of an ethernet protocol conversion gateway according to the present invention;

FIG. 5 is a flowchart illustrating steps of a data transmission method according to a first embodiment of the present invention;

FIG. 6 is a flowchart illustrating steps of a data transmission method according to a second embodiment of the present invention;

fig. 7 is a schematic diagram of device interaction of a video conference according to a second embodiment of the present invention;

fig. 8 is a schematic data transmission diagram of a video conference according to a second embodiment of the present invention;

fig. 9 is a block diagram of a data transmission apparatus according to a third embodiment of the present invention.

Detailed Description

In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.

The video networking is an important milestone for network development, is a real-time network, can realize high-definition video real-time transmission, and pushes a plurality of internet applications to high-definition video, and high-definition faces each other.

The video networking adopts a real-time high-definition video exchange technology, can integrate required services such as dozens of services of video, voice, pictures, characters, communication, data and the like on a system platform on a network platform, such as high-definition video conference, video monitoring, intelligent monitoring analysis, emergency command, digital broadcast television, delayed television, network teaching, live broadcast, VOD on demand, television mail, Personal Video Recorder (PVR), intranet (self-office) channels, intelligent video broadcast control, information distribution and the like, and realizes high-definition quality video broadcast through a television or a computer.

To better understand the embodiments of the present invention, the following description refers to the internet of view:

some of the technologies applied in the video networking are as follows:

network Technology (Network Technology)

Network technology innovation in video networking has improved over traditional Ethernet (Ethernet) to face the potentially enormous video traffic on the network. Unlike pure network Packet Switching (Packet Switching) or network circuit Switching (circuit Switching), the Packet Switching is adopted by the technology of the video networking to meet the Streaming requirement. The video networking technology has the advantages of flexibility, simplicity and low price of packet switching, and simultaneously has the quality and safety guarantee of circuit switching, thereby realizing the seamless connection of the whole network switching type virtual circuit and the data format.

Switching Technology (Switching Technology)

The video network adopts two advantages of asynchronism and packet switching of the Ethernet, eliminates the defects of the Ethernet on the premise of full compatibility, has end-to-end seamless connection of the whole network, is directly communicated with a user terminal, and directly bears an IP data packet. The user data does not require any format conversion across the entire network. The video networking is a higher-level form of the Ethernet, is a real-time exchange platform, can realize the real-time transmission of the whole-network large-scale high-definition video which cannot be realized by the existing Internet, and pushes a plurality of network video applications to high-definition and unification.

Server Technology (Server Technology)

The server technology on the video networking and unified video platform is different from the traditional server, the streaming media transmission of the video networking and unified video platform is established on the basis of connection orientation, the data processing capacity of the video networking and unified video platform is independent of flow and communication time, and a single network layer can contain signaling and data transmission. For voice and video services, the complexity of video networking and unified video platform streaming media processing is much simpler than that of data processing, and the efficiency is greatly improved by more than one hundred times compared with that of a traditional server.

Storage Technology (Storage Technology)

The super-high speed storage technology of the unified video platform adopts the most advanced real-time operating system in order to adapt to the media content with super-large capacity and super-large flow, the program information in the server instruction is mapped to the specific hard disk space, the media content is not passed through the server any more, and is directly sent to the user terminal instantly, and the general waiting time of the user is less than 0.2 second. The optimized sector distribution greatly reduces the mechanical motion of the magnetic head track seeking of the hard disk, the resource consumption only accounts for 20% of that of the IP internet of the same grade, but concurrent flow which is 3 times larger than that of the traditional hard disk array is generated, and the comprehensive efficiency is improved by more than 10 times.

Network Security Technology (Network Security Technology)

The structural design of the video network completely eliminates the network security problem troubling the internet structurally by the modes of independent service permission control each time, complete isolation of equipment and user data and the like, generally does not need antivirus programs and firewalls, avoids the attack of hackers and viruses, and provides a structural carefree security network for users.

Service Innovation Technology (Service Innovation Technology)

The unified video platform integrates services and transmission, and is not only automatically connected once whether a single user, a private network user or a network aggregate. The user terminal, the set-top box or the PC are directly connected to the unified video platform to obtain various multimedia video services in various forms. The unified video platform adopts a menu type configuration table mode to replace the traditional complex application programming, can realize complex application by using very few codes, and realizes infinite new service innovation.

Networking of the video network is as follows:

the video network is a centralized control network structure, and the network can be a tree network, a star network, a ring network and the like, but on the basis of the centralized control node, the whole network is controlled by the centralized control node in the network.

As shown in fig. 1, the video network is divided into an access network and a metropolitan network.

The devices of the access network part can be mainly classified into 3 types: node server, access switch, terminal (including various set-top boxes, coding boards, memories, etc.). The node server is connected to an access switch, which may be connected to a plurality of terminals and may be connected to an ethernet network.

The node server is a node which plays a centralized control function in the access network and can control the access switch and the terminal. The node server can be directly connected with the access switch or directly connected with the terminal.

Similarly, devices of the metropolitan network portion may also be classified into 3 types: a metropolitan area server, a node switch and a node server. The metro server is connected to a node switch, which may be connected to a plurality of node servers.

The node server is a node server of the access network part, namely the node server belongs to both the access network part and the metropolitan area network part.

The metropolitan area server is a node which plays a centralized control function in the metropolitan area network and can control a node switch and a node server. The metropolitan area server can be directly connected with the node switch or directly connected with the node server.

Therefore, the whole video network is a network structure with layered centralized control, and the network controlled by the node server and the metropolitan area server can be in various structures such as tree, star and ring.

The access network part can form a unified video platform (the part in the dotted circle), and a plurality of unified video platforms can form a video network; each unified video platform may be interconnected via metropolitan area and wide area video networking.

Video networking device classification

1.1 devices in the video network of the embodiment of the present invention can be mainly classified into 3 types: servers, switches (including ethernet gateways), terminals (including various set-top boxes, code boards, memories, etc.). The video network as a whole can be divided into a metropolitan area network (or national network, global network, etc.) and an access network.

1.2 wherein the devices of the access network part can be mainly classified into 3 types: node servers, access switches (including ethernet gateways), terminals (including various set-top boxes, code boards, memories, etc.).

The specific hardware structure of each access network device is as follows:

a node server:

as shown in fig. 2, the system mainly includes a network interface module 201, a switching engine module 202, a CPU module 203, and a disk array module 204;

the network interface module 201, the CPU module 203, and the disk array module 204 all enter the switching engine module 202; the switching engine module 202 performs an operation of looking up the address table 205 on the incoming packet, thereby obtaining the direction information of the packet; and stores the packet in a queue of the corresponding packet buffer 206 based on the packet's steering information; if the queue of the packet buffer 206 is nearly full, it is discarded; the switching engine module 202 polls all packet buffer queues for forwarding if the following conditions are met: 1) the port send buffer is not full; 2) the queue packet counter is greater than zero. The disk array module 204 mainly implements control over the hard disk, including initialization, read-write, and other operations on the hard disk; the CPU module 203 is mainly responsible for protocol processing with an access switch and a terminal (not shown in the figure), configuring an address table 205 (including a downlink protocol packet address table, an uplink protocol packet address table, and a data packet address table), and configuring the disk array module 204.

The access switch:

as shown in fig. 3, the network interface module mainly includes a network interface module (a downlink network interface module 301 and an uplink network interface module 302), a switching engine module 303 and a CPU module 304;

wherein, the packet (uplink data) coming from the downlink network interface module 301 enters the packet detection module 305; the packet detection module 305 detects whether the Destination Address (DA), the Source Address (SA), the packet type, and the packet length of the packet meet the requirements, and if so, allocates a corresponding stream identifier (stream-id) and enters the switching engine module 303, otherwise, discards the stream identifier; the packet (downstream data) coming from the upstream network interface module 302 enters the switching engine module 303; the data packet coming from the CPU module 204 enters the switching engine module 303; the switching engine module 303 performs an operation of looking up the address table 306 on the incoming packet, thereby obtaining the direction information of the packet; if the packet entering the switching engine module 303 is from the downstream network interface to the upstream network interface, the packet is stored in the queue of the corresponding packet buffer 307 in association with the stream-id; if the queue of the packet buffer 307 is nearly full, it is discarded; if the packet entering the switching engine module 303 is not from the downlink network interface to the uplink network interface, the data packet is stored in the queue of the corresponding packet buffer 307 according to the guiding information of the packet; if the queue of the packet buffer 307 is nearly full, it is discarded.

The switching engine module 303 polls all packet buffer queues, which in this embodiment of the present invention is divided into two cases:

if the queue is from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queued packet counter is greater than zero; 3) obtaining a token generated by a code rate control module;

if the queue is not from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queue packet counter is greater than zero.

The rate control module 208 is configured by the CPU module 204, and generates tokens for packet buffer queues from all downstream network interfaces to upstream network interfaces at programmable intervals to control the rate of upstream forwarding.

The CPU module 304 is mainly responsible for protocol processing with the node server, configuration of the address table 306, and configuration of the code rate control module 308.

Ethernet protocol conversion gateway

As shown in fig. 4, the apparatus mainly includes a network interface module (a downlink network interface module 401 and an uplink network interface module 402), a switching engine module 403, a CPU module 404, a packet detection module 405, a rate control module 408, an address table 406, a packet buffer 407, a MAC adding module 409, and a MAC deleting module 410.

Wherein, the data packet coming from the downlink network interface module 401 enters the packet detection module 405; the packet detection module 405 detects whether the ethernet MAC DA, the ethernet MAC SA, the ethernet length or frame type, the video network destination address DA, the video network source address SA, the video network packet type, and the packet length of the packet meet the requirements, and if so, allocates a corresponding stream identifier (stream-id); then, the MAC deletion module 410 subtracts MAC DA, MAC SA, length or frame type (2byte) and enters the corresponding receiving buffer, otherwise, discards it;

the downlink network interface module 401 detects the sending buffer of the port, and if there is a packet, acquires the ethernet MAC DA of the corresponding terminal according to the video networking destination address DA of the packet, adds the ethernet MAC DA of the terminal, the MACSA of the ethernet coordination gateway, and the ethernet length or frame type, and sends the packet.

The other modules in the ethernet protocol gateway function similarly to the access switch.

A terminal:

the system mainly comprises a network interface module, a service processing module and a CPU module; for example, the set-top box mainly comprises a network interface module, a video and audio coding and decoding engine module and a CPU module; the coding board mainly comprises a network interface module, a video and audio coding engine module and a CPU module; the memory mainly comprises a network interface module, a CPU module and a disk array module.

1.3 devices of the metropolitan area network part can be mainly classified into 2 types: node server, node exchanger, metropolitan area server. The node switch mainly comprises a network interface module, a switching engine module and a CPU module; the metropolitan area server mainly comprises a network interface module, a switching engine module and a CPU module.

2. Video networking packet definition

2.1 Access network packet definition

The data packet of the access network mainly comprises the following parts: destination Address (DA), Source Address (SA), reserved bytes, payload (pdu), CRC.

As shown in the following table, the data packet of the access network mainly includes the following parts:

DA SA Reserved Payload CRC

wherein:

the Destination Address (DA) is composed of 8 bytes (byte), the first byte represents the type of the data packet (such as various protocol packets, multicast data packets, unicast data packets, etc.), there are 256 possibilities at most, the second byte to the sixth byte are metropolitan area network addresses, and the seventh byte and the eighth byte are access network addresses;

the Source Address (SA) is also composed of 8 bytes (byte), defined as the same as the Destination Address (DA);

the reserved byte consists of 2 bytes;

the payload part has different lengths according to different types of data packets, and is 64 bytes if the data packet is a variety of protocol packets, and is 32+1024 or 1056 bytes if the data packet is a unicast data packet, of course, the length is not limited to the above 2 types;

the CRC consists of 4 bytes and is calculated in accordance with the standard ethernet CRC algorithm.

2.2 metropolitan area network packet definition

The topology of a metropolitan area network is a graph and there may be 2, or even more than 2, connections between two devices, i.e., there may be more than 2 connections between a node switch and a node server, a node switch and a node switch, and a node switch and a node server. However, the metro network address of the metro network device is unique, and in order to accurately describe the connection relationship between the metro network devices, parameters are introduced in the embodiment of the present invention: a label to uniquely describe a metropolitan area network device.

In this specification, the definition of the Label is similar to that of the Label of MPLS (Multi-Protocol Label Switch), and assuming that there are two connections between the device a and the device B, there are 2 labels for the packet from the device a to the device B, and 2 labels for the packet from the device B to the device a. The label is classified into an incoming label and an outgoing label, and assuming that the label (incoming label) of the packet entering the device a is 0x0000, the label (outgoing label) of the packet leaving the device a may become 0x 0001. The network access process of the metro network is a network access process under centralized control, that is, address allocation and label allocation of the metro network are both dominated by the metro server, and the node switch and the node server are both passively executed, which is different from label allocation of MPLS, and label allocation of MPLS is a result of mutual negotiation between the switch and the server.

As shown in the following table, the data packet of the metro network mainly includes the following parts:

DA SA Reserved label (R) Payload CRC

Namely Destination Address (DA), Source Address (SA), Reserved byte (Reserved), tag, payload (pdu), CRC. The format of the tag may be defined by reference to the following: the tag is 32 bits with the upper 16 bits reserved and only the lower 16 bits used, and its position is between the reserved bytes and payload of the packet.

23页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:流量高效引流方法、装置、设备、系统及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!