CN109587083A - Data transmission method and relevant apparatus - Google Patents
Data transmission method and relevant apparatus Download PDFInfo
- Publication number
- CN109587083A CN109587083A CN201811470222.4A CN201811470222A CN109587083A CN 109587083 A CN109587083 A CN 109587083A CN 201811470222 A CN201811470222 A CN 201811470222A CN 109587083 A CN109587083 A CN 109587083A
- Authority
- CN
- China
- Prior art keywords
- mentioned
- virtual router
- interchanger
- buffering area
- data packet
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/25—Routing or path finding in a switch fabric
- H04L49/252—Store and forward routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/58—Association of routers
- H04L45/586—Association of routers of virtual routers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/70—Virtual switches
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
This application provides a kind of data transmission method and devices, applied to interchanger, above-mentioned interchanger includes virtual router, virtual router exchange and first buffering area, and the above method includes: that the virtual router of above-mentioned interchanger receives the first data packet from terminal device;The source Internet protocol IP address of above-mentioned first data packet is substituted for preset IP address by the virtual router of above-mentioned interchanger, obtains the second data packet;The virtual router of above-mentioned interchanger stores above-mentioned second data packet to above-mentioned first buffering area, and the virtual router that above-mentioned first buffering area is used to store above-mentioned interchanger is sent to the data of the virtual router exchange of above-mentioned interchanger;The virtual router exchange of above-mentioned interchanger reads above-mentioned second data packet from above-mentioned first buffering area.Implement the application, hardware cost, the efficiency and stability of improve data transfer can be reduced.
Description
Technical field
The present invention relates to computer field more particularly to a kind of data transmission methods and device.
Background technique
Currently, internet has become indispensable a part in people's daily life.Virtual private cloud (Virtual
Private Cloud, VPC) be internet communication important component.It can be marked off from public cloud by VPC technology
Logically thoroughly Internet protocol can be arranged in isolation, user inside VPC between each other by multiple VPC, each VPC
(internet protocol, IP) address range, network segment and routing table.In order to guarantee network security, convenient for managing different masters
Machine can mark off multiple VPC subnets from VPC.
In actual use, each VPC subnet docks a router, and router receives the data of VPC subnet
The IP address of data packet is converted after packet, the data packet after conversion IP address is transmitted to router exchange.The router
Exchange is transmitted to public server after summarizing the data packet from multiple routers, to realize that the terminal under VPC subnet is set
It is standby to be communicated with public server.On the one hand, this data transmission system needs to expend a large amount of hardware device, hardware cost
It is excessively high;On the other hand, by tie-in line transmission data, data transmission efficiency is lower for multiple routers and router exchange.
Currently, usually disposing more virtual routers on an interchanger, more virtual routers receive data packet
It is transmitted to router exchange later, hardware cost can be effectively reduced.
This carry into execution a plan needs to dispose the router exchange of entity, and virtual router needs to send out data by tie-in line
Router exchange is given, the problems such as it is excessively high that there are hardware costs, and data transmission efficiency is low.
Summary of the invention
The application proposes a kind of data transmission method and relevant apparatus, can reduce hardware cost, improve data transfer
Efficiency and stability.
In a first aspect, the application proposes a kind of data transmission method, it is applied to interchanger, above-mentioned interchanger includes virtual road
Include: by device, virtual router exchange and first buffering area, the above method
The virtual router of above-mentioned interchanger receives the first data packet from terminal device;
The source Internet protocol IP address of above-mentioned first data packet is substituted for preset by the virtual router of above-mentioned interchanger
IP address obtains the second data packet;
The virtual router of above-mentioned interchanger stores above-mentioned second data packet slow to above-mentioned first buffering area, above-mentioned first
Rush the data that area is sent to the virtual router exchange of above-mentioned interchanger for storing the virtual router of above-mentioned interchanger;
The virtual router exchange of above-mentioned interchanger reads above-mentioned second data packet from above-mentioned first buffering area.
Implement the embodiment of the present application, virtual router and virtual router exchange are deployed on same interchanger, it is empty
Quasi- router quickly delivers a packet to virtual router exchange by buffer area, can reduce hardware cost, improves data
The efficiency of transmission.
With reference to first aspect, in one possible implementation, in the virtual router of above-mentioned interchanger by above-mentioned
Two data packets are sent to before first buffering area, further includes:
The virtual router of above-mentioned interchanger determines whether the residual memory space of above-mentioned first buffering area is lower than the first threshold
Value;
If being lower than first threshold, suspend storage process, above-mentioned storage process is in the virtual router of above-mentioned interchanger
For storing data into the process of above-mentioned first buffering area;
Otherwise, then start above-mentioned storage process;
The virtual router of above-mentioned interchanger stores above-mentioned second data packet to first buffering area, comprising:
The virtual router of above-mentioned interchanger is stored above-mentioned second data packet to above-mentioned first by above-mentioned storage process
Buffer area.
With reference to first aspect, in one possible implementation, in the virtual router exchange of above-mentioned interchanger from
Before reading the second data packet in one buffer area, further includes:
The virtual router exchange of above-mentioned interchanger determines that the residual memory space of data packet in above-mentioned first buffering area is
It is no to be higher than second threshold;
If being higher than second threshold, suspend reading process, above-mentioned reading process is that the virtual router of above-mentioned interchanger is total
For reading the process of data from above-mentioned first buffering area in machine;
Otherwise, then start reading process;
The virtual router exchange of above-mentioned interchanger reads above-mentioned second data packet from above-mentioned first buffering area, comprising:
The virtual router exchange of above-mentioned interchanger reads above-mentioned the from above-mentioned first buffering area by above-mentioned reading process
Two data packets.
In one possible implementation, above-mentioned interchanger further includes second buffering area, and above-mentioned second buffering area is used for
Store above-mentioned interchanger virtual router exchange be sent to above-mentioned interchanger virtual router data, in above-mentioned interchanger
Virtual router exchange is after reading above-mentioned second data packet in above-mentioned first buffering area, the above method further include:
The virtual router exchange of above-mentioned interchanger verifies above-mentioned second data packet received, obtains verification letter
Breath;
Above-mentioned check information is sent to above-mentioned second buffering area by the virtual router exchange of above-mentioned interchanger.
In one possible implementation, above-mentioned check information is sent in the virtual router exchange of above-mentioned interchanger
After above-mentioned second buffering area, the above method further include:
The virtual router of above-mentioned interchanger reads above-mentioned check information from above-mentioned second buffering area;
The virtual router of above-mentioned interchanger determines the virtual router exchange of above-mentioned interchanger according to above-mentioned check information
Above-mentioned second data packet received whether mistake;
If mistake, above-mentioned second data packet is sent to first buffering area again.
In one possible implementation, it before above-mentioned second data packet is sent to first buffering area again, also wraps
It includes:
Above-mentioned second data packet is sent to backup area by the virtual router of above-mentioned interchanger, and above-mentioned backup area is above-mentioned exchange
Storage region in the virtual router of machine for being backed up to data packet.
In conjunction with second aspect, in one possible implementation, the virtual router of above-mentioned interchanger determines above-mentioned
Whether the residual memory space of one buffer area is lower than first threshold, comprising:
Above-mentioned virtual router can obtain the residual memory space of above-mentioned first buffering area using preset time as the period, and
Determine whether the residual memory space of above-mentioned first buffering area is lower than first threshold.
In one possible implementation, the above method further include:
The virtual router of above-mentioned interchanger read failure information from above-mentioned second buffering area, above-mentioned fault message are used for
Indicate that the virtual router exchange of above-mentioned interchanger is in malfunction;
If the virtual router of above-mentioned interchanger reads above-mentioned fault message, storage process is closed.
Implement the embodiment of the present application, sending port can be closed in time when virtual router exchange breaks down, avoided
Loss of data and error of transmission, the stability of improve data transfer, while saving the resource of interchanger.
Second aspect, the application propose a kind of data transmission device characterized by comprising
Receiving unit, for receiving the first data packet from terminal device;
Converting unit is obtained for the source Internet protocol IP address of above-mentioned first data packet to be substituted for preset IP address
To the second data packet;
Storage unit, for by above-mentioned second data packet storage to above-mentioned first buffering area, above-mentioned first buffering area to be used for
Store above-mentioned interchanger virtual router be sent to above-mentioned interchanger virtual router exchange data;
Reading unit, for reading above-mentioned second data packet from above-mentioned first buffering area.
In conjunction with second aspect, in one possible implementation, above-mentioned apparatus further include:
First determination unit, for determining whether the residual memory space of above-mentioned first buffering area is lower than first threshold;
First pause unit, when being lower than first threshold for the residual memory space in above-mentioned first buffering area, pause is deposited
Storage process, above-mentioned storage process be interchanger virtual router in for store data into above-mentioned first buffering area into
Journey;
First start unit, when being not less than first threshold for the residual memory space in above-mentioned first buffering area, starting
Above-mentioned storage process;
Said memory cells are specifically used for storing above-mentioned second data to above-mentioned first buffering area by above-mentioned storage process
Packet.
In conjunction with second aspect, in one possible implementation, above-mentioned apparatus further include:
Whether the second determination unit, the residual memory space for determining in above-mentioned first buffering area are higher than second threshold;
Second pause unit, when being higher than second threshold for the residual memory space in above-mentioned first buffering area, pause
Reading process, above-mentioned reading process are in the virtual router exchange of above-mentioned interchanger for reading number from above-mentioned first buffering area
According to process;
Second start unit opens when being not higher than second threshold for the residual memory space in above-mentioned first buffering area
Move above-mentioned reading process;
Above-mentioned reading unit is specifically used for reading above-mentioned second data from above-mentioned first buffering area by above-mentioned reading process
Packet.
In conjunction with second aspect, in one possible implementation, above-mentioned apparatus further include:
Verification unit is verified for verifying to the second data packet read from above-mentioned first buffering area
Information;
Second storage unit, for storing above-mentioned check information to second buffering area.
In one possible implementation, above-mentioned apparatus further include:
Second reading unit, for reading check information from above-mentioned second buffering area;
Third determination unit, for determining that the virtual router exchange of above-mentioned interchanger is received according to above-mentioned check information
Above-mentioned second data packet whether mistake;
Closing unit, above-mentioned second data packet for receiving in the virtual router exchange for determining above-mentioned interchanger are
In the case where mistake, storage process is closed.
The third aspect, the application propose a kind of data transmission device, including processor, memory and transceiver;Above-mentioned place
Device, above-mentioned memory and above-mentioned transceiver is managed to be connected with each other by bus;Wherein, above-mentioned transceiver is for sending and receiving data
Packet, above-mentioned memory is for storing computer program, and above-mentioned computer program includes program instruction, and above-mentioned processor is configured to use
In calling above procedure instruction, the above-mentioned method of above-mentioned first aspect is executed.
Fourth aspect, the application propose a kind of computer readable storage medium, which is characterized in that above-mentioned computer-readable to deposit
Storage media is stored with computer program, and above-mentioned computer program includes program instruction, and above procedure instruction, which is worked as, to be executed by processor
When, so that above-mentioned processor is executed such as the above-mentioned method of first aspect.
5th aspect, the embodiment of the present application provides a kind of computer program product comprising program instruction, when it is being counted
When being run on calculation machine, so that computer executes method as described in relation to the first aspect.
Implement the application, hardware cost, the efficiency and stability of improve data transfer can be reduced.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application or in background technique below will be implemented the application
Attached drawing needed in example or background technique is illustrated.
Fig. 1 is a kind of structural schematic diagram for data transmission system that the application proposes;
Fig. 2 is a kind of flow chart for data transmission method that the application proposes;
Fig. 3 is the flow chart for another data transmission method that the application proposes;
Fig. 4 is the flow chart for another data transmission method that the application proposes;
Fig. 5 is a kind of structural schematic diagram for data transmission device that the application proposes;
Fig. 6 is the structural schematic diagram for another data transmission device that the application proposes;
Fig. 7 is the structural schematic diagram for another data transmission device that the application proposes;
Fig. 8 is the structural schematic diagram for another data transmission device that the application proposes.
Specific embodiment
The description and claims of this application and term " first " in above-mentioned attached drawing, " second " etc. are for distinguishing
Different objects, is not use to describe a particular order.In addition, term " includes " and " having " and their any deformations, meaning
Figure, which is to cover, non-exclusive includes.Such as contain the process, method, system, product or equipment of a series of steps or units
It is not limited to listed step or unit, but optionally further comprising the step of not listing or unit, or optionally also
Including other step or units intrinsic for these process, methods or equipment.
The application proposes a kind of data transmission method and device, can reduce hardware cost, the efficiency of improve data transfer
And stability.The embodiment of the present application is described below in conjunction with attached drawing.
Fig. 1 is a kind of data transmission system frame diagram that the application proposes.It will be seen from figure 1 that the system includes at least
One terminal device 101, interchanger 102 and public server 103.Wherein, above-mentioned interchanger 102 includes that at least one is virtual
Router 102A, at least one first buffering area 102B, at least one second buffering area 102D and virtual router exchange 102C.
The first data packet that the virtual router 102A receiving terminal apparatus 101 of above-mentioned interchanger 102 is sent, and by above-mentioned first data
The source IP address of packet is substituted for preset IP address, obtains the second data packet, then above-mentioned second data packet is stored to first and is delayed
It rushes in area 102B.The virtual router exchange 102C of above-mentioned interchanger 102 read data packet from above-mentioned first buffering area 102B,
Above-mentioned data packet is transmitted to public server 103 again.
In one possible implementation, data information can be passed through above-mentioned the by above-mentioned virtual router exchange 102C
Two buffer area 102D are sent to virtual router 102B.Above-mentioned virtual router exchange 102C can be by data information memory to upper
It states in second buffering area 102D, above-mentioned virtual router 102A reads the data information from above-mentioned second buffering area 102D.Its
In, above-mentioned data information may include data packet from public server, above-mentioned second data packet check information and on
It states one or more in the fault message of virtual router exchange 102C.
Implement the embodiment of the present application, virtual router and virtual router exchange be deployed in same interchanger, can be with
Reduce hardware cost;Data exchange is carried out by buffer area between virtual router and virtual router exchange, number can be accelerated
According to efficiency of transmission, the stability of improve data transfer.
Fig. 2 is a kind of flow chart for data transmission method that the application proposes.The above method is applied to interchanger, above-mentioned friendship
Changing planes including virtual router, virtual router exchange and first buffering area, the above method includes the following contents:
201, the virtual router of above-mentioned interchanger receives the first data packet from terminal device.
Above-mentioned interchanger is to provide the hardware device in signal communication channel for two network nodes, and above-mentioned interchanger can be taken
Carry suitable operating system and and various softwares.Above-mentioned terminal device may include that there is the hand-held of wireless communication function to set
Standby, mobile unit, wearable device calculate equipment or are connected to other processing equipments of radio modem and various
The user equipment (user equipment, UE) of form, mobile station (mobile station, MS) etc..Wherein, above-mentioned terminal is set
It is standby to be likely located in same VPC subnet.
Above-mentioned virtual router deployment on switches, possesses independent routing table, input/output (Input/Out, I/
O the forwarding of data packet and the replacement of data packet IP address may be implemented in) port, caching and address space etc..In a kind of possibility
Implementation in, above-mentioned virtual router may have multiple, and each virtual router can be docked respectively under different VPC subnets
Terminal device.
Specifically, the packet header of above-mentioned first data packet may include the Internet protocol (Internet of virtual router
Protocol, IP) address, the IP address of terminal device and target device IP address in one or more, above-mentioned first
The payload of data packet is data information to be transmitted.
In one possible implementation, if there is terminal device under multiple same VPC subnets to above-mentioned virtual flow-line
Device sends data packet, and above-mentioned virtual router can establish connection with each terminal device in sequence, successively receives terminal and sets
Standby data packet.Alternatively, above-mentioned virtual router can open multiple receiving threads, received simultaneously by different receiving ports
Data packet from each terminal device, wherein corresponded between thread and receiving port and terminal device.
202, the source Internet protocol IP address of above-mentioned first data packet is substituted for pre- by the virtual router of above-mentioned interchanger
If IP address, obtain the second data packet.
When the network segment of user setting VPC subnet, above-mentioned network segment may be identical as the network segment of other VPC subnets.VPC subnet is given
After terminal device distributes IP address, the IP address of above-mentioned terminal device may have phase with the terminal device under other VPC subnets
Same IP address causes server-side possibly can not identify the IP address of above-mentioned terminal device.Above-mentioned virtual router can will be upper
The IP address for stating the data packet of terminal device transmission is substituted for preset IP, and server is allowed to identify above-mentioned terminal device.
Specifically, above-mentioned virtual router the source IP address of above-mentioned first data packet can be substituted for it is with uniqueness
Public ip address.For example, the IP address of above-mentioned first data packet can be substituted for 1.0.0.0 to 9.255.255.255
Between an IP address.
Specifically, above-mentioned virtual router can retain a part of the source IP address of above-mentioned first data packet, according to pre-
If rule replace another part, obtain preset IP address.In one possible implementation, above-mentioned virtual router
The network number of the source IP address of above-mentioned first data packet can be substituted for the network number of public ip address, retain host number.I.e.
The network number of the host number of source IP address and public ip address is combined, obtains preset IP address, then by source IP address
It is substituted for above-mentioned preset IP address.
203, the virtual router of above-mentioned interchanger stores above-mentioned second data packet to above-mentioned first buffering area, and above-mentioned the
The virtual router that one buffer area is used to store above-mentioned interchanger is sent to the data of the virtual router exchange of above-mentioned interchanger.
Optionally, above-mentioned first buffering area can be queue data structure.Above-mentioned queue data structure meets " advanced elder generation
Principle out ", i.e., the data packet first stored into queue are first taken out.In one possible implementation, above-mentioned queuing data
Structure can be circle queue, i.e., above-mentioned virtual router can be along circle queue recurrent wrIting data, above-mentioned virtual flow-line
Device exchange recycles along circle queue and reads data.Above-mentioned first buffering area is deployed on above-mentioned interchanger, is preferably deployed in
In the memory of interchanger, above-mentioned memory can be high-speed random access memory (random access memory, RAM).
In one possible implementation, above-mentioned second data packet is being sent to first buffering area by above-mentioned virtual router
Before, it can first judge whether above-mentioned first buffering area is filled.If above-mentioned first buffering area is filled, suspend transmission data
The data packet of the process of packet, pending buffer area, which is read and then continues up, states buffer area write-in data.Specifically, above-mentioned
Virtual router can calculate the residual memory space of above-mentioned first buffering area, if the residual memory space of above-mentioned first buffering area
It is zero, then suspends the process of write-in data.More specifically, if above-mentioned first buffering area is circle queue data structure, above-mentioned void
When quasi- router memory space corresponding to the next address for accessing circle queue, if corresponding to above-mentioned next address
Memory space is written into data, it is determined that above-mentioned circle queue is filled, and above-mentioned virtual router can suspend write-in data
Process.
204, the virtual router exchange of above-mentioned interchanger reads above-mentioned second data packet from above-mentioned first buffering area.
Above-mentioned virtual router exchange deployment in a switch, can read from first buffering area and come from virtual router
The second data packet, and above-mentioned second data packet is sent to public server.
In one possible implementation, above-mentioned multiple virtual if disposing multiple virtual routers in above-mentioned interchanger
Router can respectively correspond a first buffering area, and above-mentioned virtual router exchange can be read respectively from multiple first buffering areas
The data packet that each virtual router is sent.Specifically, above-mentioned virtual router exchange can create multiple reading threads, it is above-mentioned
Multiple reading threads pass through each read port read data packet, i.e., the corresponding read port and one of one reading process respectively
A first buffering area.Optionally, in order to reduce the resource overhead of interchanger, above-mentioned virtual router exchange can open a reading
Line taking journey, in a manner of poll from each first buffering area read data packet.In above-mentioned virtual router exchange from above-mentioned more
In a first buffering area after read data packet, the data packet of above-mentioned multiple first buffering areas is sent to public server.
Implement the embodiment of the present application, hardware cost, the efficiency and stability of improve data transfer can be reduced.
Fig. 3 is the flow chart for another data transmission method that the application proposes.The above method is applied to interchanger, above-mentioned
Interchanger includes virtual router, virtual router exchange, first buffering area and second buffering area.The above method includes following
Content:
301, the virtual router of interchanger receives the first data packet from terminal device.
302, the virtual router of above-mentioned interchanger by the source IP address of above-mentioned first data packet with being substituted for preset IP
Location obtains the second data packet.
303, the virtual router of above-mentioned interchanger determines whether the residual memory space of above-mentioned first buffering area is lower than
One threshold value;If being lower than first threshold, suspend storage process, above-mentioned storage process be above-mentioned interchanger virtual router in use
In the process for storing data into above-mentioned first buffering area;Otherwise, then start above-mentioned storage process.
In actual operation, it when above-mentioned first buffering area is filled up by data, is stated if above-mentioned virtual router continues up
Data are written in first buffering area, then original data may be capped in above-mentioned first buffering area, cause data loss problem.?
The residual memory space of first buffering area suspends in time when being lower than first threshold to first buffering area storing data packet, can be to avoid
Original data are capped.
In one possible implementation, the virtual router of above-mentioned interchanger is slow to above-mentioned first in storing data packet
It rushes before area, the above method further include: above-mentioned virtual router creates storage process.
Specifically, above-mentioned first threshold can be the designated ratio of the total memory space of above-mentioned first buffering area.For example,
Above-mentioned first threshold can be the 5% of the total memory space of first buffering area, when above-mentioned virtual router determines above-mentioned first buffering
When the residual memory space in area is lower than the 5% of total memory space, suspend storage process.In one possible implementation, on
Stating virtual router (i.e. residual memory space is zero) can suspend above-mentioned storage process when above-mentioned first buffering area is filled.
In one possible implementation, above-mentioned storage process can be suspended preset time by above-mentioned virtual router,
If i.e. above-mentioned virtual router detects the residual memory space of above-mentioned first buffering area lower than first threshold, when waiting default
Between after be further continued for above-mentioned first buffering area storing data packet.
In one possible implementation, above-mentioned virtual router can obtain above-mentioned first by the period of preset time
The residual memory space of buffer area, and determine whether the residual memory space of above-mentioned first buffering area is lower than first threshold;If low
In first threshold, then suspend storage process;Otherwise, then start above-mentioned storage process.
304, the virtual router of above-mentioned interchanger is stored above-mentioned second data packet to above-mentioned by above-mentioned storage process
First buffering area.
305, the virtual router exchange of above-mentioned interchanger determines whether the residual memory space of above-mentioned first buffering area is high
In second threshold;If being higher than second threshold, suspend reading process;Above-mentioned reading process is the virtual router of above-mentioned interchanger
For reading the process of data from above-mentioned first buffering area in exchange;Otherwise, then start reading process.
In one possible implementation, before the virtual router exchange starting reading process of above-mentioned interchanger, on
State method further include: above-mentioned virtual router exchange creates reading process.
Specifically, above-mentioned second threshold can be the designated ratio of the total memory space of first buffering area.For example, above-mentioned
Second threshold can be the 5% of the total memory space of first buffering area, when above-mentioned virtual router determines above-mentioned first buffering area
When memory space is lower than the 5% of total memory space, suspend storage process.In one possible implementation, above-mentioned virtual road
By device can when above-mentioned first buffering area has been read (i.e. residual memory space be total memory space) pause it is above-mentioned store into
Journey.
In one possible implementation, when above-mentioned virtual router exchange can be default by above-mentioned reading process suspension
Between, if that is, above-mentioned virtual router exchange detects that the residual memory space of above-mentioned first buffering area is higher than second threshold, etc.
To be further continued for after preset time to above-mentioned second buffering area storing data packet.
In one possible implementation, above-mentioned virtual router exchange can obtain above-mentioned using preset time as the period
The residual memory space of first buffering area, and determine whether the residual memory space of above-mentioned first buffering area is higher than second threshold;
If being higher than second threshold, suspend reading process;Otherwise, then start above-mentioned reading process.
In the embodiment of the present application, when the data of above-mentioned first buffering area have been read, if above-mentioned virtual router exchange
It continues up and states first buffering area reading data, on the one hand may cause read pointer and write pointer intersects, lead to virtual router
It cannot correctly be read with virtual router exchange and storing data, on the other hand can waste the resource of interchanger.In the first buffering
The residual memory space in area is then turned on reading process when being lower than second threshold, can be to avoid the read pointer and write pointer of the process of reading
The problem that halved belt comes, can also save switch resource.
306, the virtual router exchange of above-mentioned interchanger is by above-mentioned reading process from the reading of above-mentioned first buffering area
State the second data packet.
307, the virtual router exchange of above-mentioned interchanger verifies above-mentioned second data packet received, obtains school
Test information;The virtual router exchange of above-mentioned interchanger stores above-mentioned check information to above-mentioned second buffering area.
After above-mentioned virtual router exchange receives above-mentioned second data packet, above-mentioned data packet can be verified,
Check information is obtained, whether just above-mentioned check information is determined for data packet that above-mentioned virtual router exchange receives
Really.Specifically, the calibration technology verified to above-mentioned second data packet may include total check, exclusive or check, odd even school
It tests.
By taking total check technology as an example, above-mentioned virtual router exchange can data to above-mentioned data packet with byte be single
Position be added, then will it is resulting and to 256 progress modulo operations, obtained result is total check code.Above-mentioned target network
After total check code is calculated in pass, above-mentioned total check code is sent to above-mentioned second buffering area, so as to above-mentioned virtual router
Above-mentioned total check code is verified.
308, the virtual router of above-mentioned interchanger reads above-mentioned check information from above-mentioned second buffering area;Above-mentioned exchange
The virtual router of machine determine that the virtual router exchange of above-mentioned interchanger receives according to above-mentioned check information above-mentioned second
Data packet whether mistake;If mistake, above-mentioned second data packet is sent to first buffering area again.
Above-mentioned virtual router includes above-mentioned check information from the data that second buffering area is read, and above-mentioned virtual router obtains
After obtaining check information, above-mentioned check information and preset check information template can be compared, it is above-mentioned virtual with determination
The second data packet that router exchange receives whether mistake.
By taking total check technology as an example, above-mentioned virtual router can will acquire above-mentioned before sending the second data packet
The total check code of second data packet is as preset check information template.Above-mentioned virtual router is read from above-mentioned second buffering area
It after taking check information, is compared with preset check information template, judges above-mentioned check information and above-mentioned preset verification
Whether information model matches.If matching, the data packet for illustrating that above-mentioned virtual router exchange receives are correct;Otherwise, then it says
The data packet that bright above-mentioned virtual router exchange receives is incorrect.
If the second data packet that above-mentioned virtual router determines that above-mentioned virtual router exchange receives is incorrect, will be upper
The second data packet is stated to be stored again to above-mentioned second buffering area.Wherein, above-mentioned second data packet is being stored again to above-mentioned the
Before two buffer areas, above-mentioned second data packet can be backed up the backup in above-mentioned virtual router by above-mentioned virtual router
Qu Zhong, above-mentioned backup area can be queue data structure.
Implement the embodiment of the present application, hardware cost can be reduced, the efficiency and stability of improve data transfer reduce data
The error rate of transmission.
Fig. 4 is the flow chart for another data transmission method that the application proposes.The above method is applied to interchanger, above-mentioned
Interchanger includes virtual router, virtual router exchange, first buffering area and second buffering area.The above method includes following
Content:
401, the virtual router of interchanger receives the first data packet from terminal device.
402, the source IP address of above-mentioned first data packet is substituted for public ip address by the virtual router of above-mentioned interchanger,
Obtain the second data packet.
403, the virtual router of above-mentioned interchanger determines whether above-mentioned first buffering area is filled;If being filled, temporarily
Stop storage process, above-mentioned storage process is in the virtual router of above-mentioned interchanger for storing data into above-mentioned first buffering
The process in area;Otherwise, then start above-mentioned storage process.
For example, above-mentioned virtual router can read the byte quantity of above-mentioned first buffering area, if above-mentioned first is slow
Rush area byte quantity be equal to above-mentioned first buffering area total memory space byte number, then illustrate that above-mentioned first buffering area is filled out
It is full;If the byte quantity of above-mentioned first buffering area is less than the byte number of total memory space of first buffering area, illustrate above-mentioned the
One buffer area is filled.
Again for example, if above-mentioned first buffering area is circle queue, above-mentioned virtual router may determine that above-mentioned annular
Whether the next address of queue is written into data.If being written into data, illustrate that above-mentioned first buffering area has been filled.
404, the virtual router of above-mentioned interchanger is stored above-mentioned second data packet to above-mentioned by above-mentioned storage process
First buffering area.
405, the virtual router exchange of above-mentioned interchanger determines whether the data volume of above-mentioned first buffering area is zero;If
Zero, then suspend reading process;Otherwise, then start storage process.
Above-mentioned virtual router exchange can read the byte number of the data of above-mentioned first buffering area storage, if above-mentioned byte
Number is zero and suspends above-mentioned reading process;Otherwise, then start above-mentioned reading process.
In one possible implementation, above-mentioned virtual router exchange can be read above-mentioned using preset time as the period
The byte number of the data of first buffering area storage, determines whether the data volume of above-mentioned first buffering area is zero;If zero, then suspend
Reading process;Otherwise, then start reading process.
406, the virtual router exchange of above-mentioned interchanger is by above-mentioned reading process from the reading of above-mentioned first buffering area
State the second data packet.
407, the virtual router exchange of above-mentioned interchanger carries out total check to above-mentioned second data packet received, obtains
To total check code;The virtual router exchange of above-mentioned interchanger stores above-mentioned total check code to above-mentioned second buffering area.
Above-mentioned virtual router exchange can be added the data of above-mentioned second data packet as unit of byte, then will
It is resulting and to 256 carry out modulo operations, obtained result is total check code.Above-mentioned virtual router exchange obtains above-mentioned
After total check code, by above-mentioned total check code storage to above-mentioned second buffering area.
408, the virtual router of above-mentioned interchanger reads above-mentioned total check code from above-mentioned second buffering area;Above-mentioned friendship
The virtual router changed planes according to above-mentioned total check code determine above-mentioned interchanger virtual router exchange receive it is above-mentioned
Second data packet whether mistake;If mistake, above-mentioned second data packet is stored again to first buffering area.
Above-mentioned virtual router is available above-mentioned before by the storage to above-mentioned first buffering area of above-mentioned second data packet
The total check code of second data packet is as check information template.Above-mentioned virtual router is read from above-mentioned second buffering area
After above-mentioned total check code, above-mentioned total check code can be compared with check information template.If above-mentioned total check
Code and above-mentioned check information template matching, it is determined that above-mentioned second data packet that above-mentioned virtual router exchange receives is correct;
Otherwise above-mentioned second packet error that above-mentioned virtual router exchange receives is determined.
409, the virtual router of above-mentioned interchanger is from above-mentioned second buffering area read failure information, above-mentioned fault message table
Show that above-mentioned virtual router exchange is in malfunction;If the virtual router of above-mentioned interchanger reads above-mentioned fault message,
Then close reading process.
When above-mentioned virtual router exchange breaks down, fault message can be sent to above-mentioned second buffering area.Alternatively,
When above-mentioned second buffering area detects that the read port of virtual router exchange or write port are closed extremely, failure letter is generated
Breath.
If virtual router reads above-mentioned fault message, reading process is closed, avoids loss of data, while saving friendship
The resource changed planes.
Implement the embodiment of the present application, hardware cost can be reduced, the efficiency and stability of improve data transfer reduce data
The error rate of transmission saves the resource of interchanger.
Referring to Fig. 5, Fig. 5 is a kind of structural schematic diagram of data transmission device provided by the embodiments of the present application, above-mentioned dress
It sets and includes:
Receiving unit 501, for receiving the first data packet from terminal device;
Converting unit 502, for the source Internet protocol IP address of above-mentioned first data packet to be substituted for preset IP address,
Obtain the second data packet;
Storage unit 503, for by above-mentioned second data packet storage to above-mentioned first buffering area, above-mentioned first buffering area to be used
The data of the virtual router exchange of above-mentioned interchanger are sent in the virtual router for storing above-mentioned interchanger;
Reading unit 504, for reading above-mentioned second data packet from above-mentioned first buffering area.
As shown in fig. 6, above-mentioned apparatus further include:
First determination unit 505, for determining whether the residual memory space of above-mentioned first buffering area is lower than first threshold;
First pause unit 506, when being lower than first threshold for the residual memory space in above-mentioned first buffering area, pause
Storage process, above-mentioned storage process be interchanger virtual router in for store data into above-mentioned first buffering area into
Journey;
First start unit 507 opens when being not less than first threshold for the residual memory space in above-mentioned first buffering area
Move above-mentioned storage process;
Whether the second determination unit 508, the residual memory space for determining in above-mentioned first buffering area are higher than the second threshold
Value;
Second pause unit 509, when being higher than second threshold for the residual memory space in above-mentioned first buffering area, temporarily
Stop reading process, above-mentioned reading process is in the virtual router exchange of above-mentioned interchanger for reading from above-mentioned first buffering area
The process of data;
Second start unit 510, when being not higher than second threshold for the residual memory space in above-mentioned first buffering area,
Start reading process.
In one possible implementation, said memory cells 503 be specifically used for will be above-mentioned by above-mentioned storage process
Second data packet is stored to above-mentioned first buffering area.
In one possible implementation, above-mentioned reading unit 504 is specifically used for through above-mentioned reading process from above-mentioned
First buffering area reads above-mentioned second data packet.
As shown in fig. 7, above-mentioned apparatus further include:
Verification unit 511 obtains school for verifying to the second data packet read from above-mentioned first buffering area
Test information;
Second storage unit 512, for storing above-mentioned check information to second buffering area.
In one possible implementation, above-mentioned apparatus further include:
Second reading unit 513, for reading check information from above-mentioned second buffering area;
Third determination unit 514, for determining that the virtual router exchange of above-mentioned interchanger connects according to above-mentioned check information
Above-mentioned second data packet received whether mistake;
Closing unit 515, above-mentioned second data packet received for the virtual router exchange in above-mentioned interchanger are
In the case where mistake, storage process is closed.
It is understood that the specific implementation of Fig. 5, Fig. 6 and data transmission device shown in Fig. 7 reference may also be made to Fig. 2, Fig. 3 and
Method shown in Fig. 4, is no longer described in detail one by one here.
Implement the embodiment of the present application, hardware cost can be reduced, the efficiency and stability of improve data transfer reduce data
The error rate of transmission saves hardware resource.
Referring to Fig. 8, Fig. 8 is the structural schematic diagram of another data transmission device provided by the embodiments of the present application.The dress
Setting includes: at least one processor 801, such as central processing unit (central processing unit, CPU), at least one
Memory 802, at least one transceiver 803 and at least one bus 804.Wherein, above-mentioned bus 804 can be one group it is parallel
Data line, for realizing the interconnection of above-mentioned processor 801, above-mentioned memory 802 and above-mentioned transceiver 803;Above-mentioned storage
Device 802 can be high-speed random access memory (random access memory, RAM), be also possible to non-volatile memories
Device (non-volatile memory), for example, at least a read-only memory (read only memory, ROM).
Specifically, above-mentioned transceiver 803 can be used for the data packet of receiving terminal apparatus transmission;For above-mentioned data packet to be sent out
Toward public server.
In one possible implementation, above-mentioned transceiver 803 can also be used to receive the data that public server is sent
Packet, and above-mentioned data packet is transmitted to terminal device, to realize the communication between terminal device and server.
In one possible implementation, program instruction, above-mentioned processor 801 be can store in above-mentioned memory 802
It can be used for method shown in caller instruction execution Fig. 2, Fig. 3 and Fig. 4.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can
It is completed with instructing relevant hardware by program, which can be stored in a computer readable storage medium, storage
Medium include read-only memory (read only memory, ROM), random access memory (random access memory,
RAM), programmable read only memory (programmable read only memory, PROM), erasable programmable is read-only deposits
Reservoir (erasable programmable read only memory, EPROM), disposable programmable read-only memory (one-
Time programmable read-only memory, OTPROM), the electronics formula of erasing can make carbon copies read-only memory
(electrically-erasable programmable read-only memory, EEPROM), CD-ROM (compact
Disc read-only memory, CD-ROM) or other disc memories, magnetic disk storage, magnetic tape storage or can
For carrying or any other computer-readable medium of storing data.
A kind of data transmission method and device disclosed in the embodiment of the present application are described in detail above, answered herein
With specific case, the principle and implementation of this application are described, and the explanation of above example is only intended to help to manage
Solve the present processes and its core concept;At the same time, for those skilled in the art, according to the thought of the application,
There will be changes in specific embodiment and application range.In conclusion the content of the present specification should not be construed as to this Shen
Limitation please.
Claims (10)
1. a kind of data transmission method, which is characterized in that be applied to interchanger, the interchanger includes virtual router, virtual
Router exchange and first buffering area, which comprises
The virtual router of the interchanger receives the first data packet from terminal device;
The virtual router of the interchanger by the source Internet protocol IP address of first data packet with being substituted for preset IP
Location obtains the second data packet;
The virtual router of the interchanger stores second data packet to the first buffering area, the first buffering area
Virtual router for storing the interchanger is sent to the data of the virtual router exchange of the interchanger;
The virtual router exchange of the interchanger reads second data packet from the first buffering area.
2. method according to claim 1, which is characterized in that the interchanger virtual router by second data
Packet is sent to before first buffering area, further includes:
The virtual router of the interchanger determines whether the residual memory space of the first buffering area is lower than first threshold;
If being lower than first threshold, suspend storage process, the storage process be the interchanger virtual router in be used for
Store data into the process of the first buffering area;
Otherwise, then start the storage process;
The virtual router of the interchanger stores second data packet to first buffering area, comprising:
The virtual router of the interchanger is stored second data packet to first buffering by the storage process
Area.
3. requiring 1 the method according to power, which is characterized in that the interchanger virtual router exchange from first buffering area
Before the second data packet of middle reading, further includes:
The virtual router exchange of the interchanger determines whether the residual memory space in the first buffering area is higher than second
Threshold value;
If being higher than second threshold, suspend reading process, the reading process is in the virtual router exchange of the interchanger
For reading the process of data from the first buffering area;
Otherwise, then start reading process;
The virtual router exchange of the interchanger reads second data packet from the first buffering area, comprising:
The virtual router exchange of the interchanger reads second number from the first buffering area by the reading process
According to packet.
4. according to claim 1 to 3 the methods, which is characterized in that the interchanger further includes second buffering area, and described second
The virtual router exchange that buffer area is used to store the interchanger is sent to the data of the virtual router of the interchanger, in institute
The virtual router exchange of interchanger is stated after reading second data packet in the first buffering area, the method is also wrapped
It includes:
The virtual router exchange of the interchanger verifies second data packet received, obtains check information;
The virtual router exchange of the interchanger stores the check information to the second buffering area.
5. method according to claim 4, which is characterized in that the interchanger virtual router exchange by the verification
Information is sent to after the second buffering area, further includes:
The virtual router of the interchanger reads the check information from the second buffering area;
The virtual router of the interchanger determines that the virtual router exchange of the interchanger receives according to the check information
Second data packet arrived whether mistake;
If mistake, second data packet is sent to first buffering area again.
6. a kind of data transmission device characterized by comprising
Receiving unit, for receiving the first data packet from terminal device;
Converting unit obtains for the source Internet protocol IP address of first data packet to be substituted for preset IP address
Two data packets;
Storage unit, for by second data packet storage to the first buffering area, the first buffering area to be for storing
The virtual router of the interchanger is sent to the data of the virtual router exchange of the interchanger;
Reading unit, for reading second data packet from the first buffering area.
7. method according to claim 6, which is characterized in that further include:
First determination unit, for determining whether the residual memory space of the first buffering area is lower than first threshold;
First pause unit, for the residual memory space in the first buffering area be lower than first threshold when, pause store into
Journey, the storage process are in the virtual router of interchanger for storing data into the process of the first buffering area;
First start unit, when being not less than first threshold for the residual memory space in the first buffering area, described in starting
Storage process;
First reading unit is specifically used for reading second data from the first buffering area by the reading process
Packet.
8. method according to claim 6, which is characterized in that further include:
Whether the second determination unit, the residual memory space for determining in the first buffering area are higher than second threshold;
Second pause unit, when being higher than second threshold for the residual memory space in the first buffering area, pause is read
Process, the reading process are in the virtual router exchange of the interchanger for reading data from the first buffering area
Process;
Second start unit, when being not higher than second threshold for the residual memory space in the first buffering area, starting is read
Take process.
9. a kind of data transmission device, which is characterized in that including processor, memory and transceiver;The processor described is deposited
Reservoir and the transceiver are connected with each other by bus;Wherein, the transceiver is for sending and receiving data packet, the storage
Device is for storing computer program, and the computer program includes program instruction, and the processor is configured for described in calling
Program instruction executes such as method described in any one of claim 1 to 5.
10. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer journey
Sequence, the computer program include program instruction, and described program instructs when being executed by a processor, execute the processor such as
Method described in any one of claim 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811470222.4A CN109587083B (en) | 2018-11-30 | 2018-11-30 | Data transmission method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811470222.4A CN109587083B (en) | 2018-11-30 | 2018-11-30 | Data transmission method and related device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109587083A true CN109587083A (en) | 2019-04-05 |
CN109587083B CN109587083B (en) | 2022-04-29 |
Family
ID=65927138
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811470222.4A Active CN109587083B (en) | 2018-11-30 | 2018-11-30 | Data transmission method and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109587083B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110493227A (en) * | 2019-08-20 | 2019-11-22 | 上海集成电路研发中心有限公司 | A kind of data frame transmission method and system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8094659B1 (en) * | 2007-07-09 | 2012-01-10 | Marvell Israel (M.I.S.L) Ltd. | Policy-based virtual routing and forwarding (VRF) assignment |
CN103595772A (en) * | 2013-11-01 | 2014-02-19 | 浪潮电子信息产业股份有限公司 | Cloud data center network deployment scheme based on virtual router |
CN107229492A (en) * | 2017-05-17 | 2017-10-03 | 东软集团股份有限公司 | Installation method, device, system, storage medium and the equipment of server system |
CN107846358A (en) * | 2016-09-19 | 2018-03-27 | 北京金山云网络技术有限公司 | A kind of data transmission method, device and network system |
-
2018
- 2018-11-30 CN CN201811470222.4A patent/CN109587083B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8094659B1 (en) * | 2007-07-09 | 2012-01-10 | Marvell Israel (M.I.S.L) Ltd. | Policy-based virtual routing and forwarding (VRF) assignment |
CN103595772A (en) * | 2013-11-01 | 2014-02-19 | 浪潮电子信息产业股份有限公司 | Cloud data center network deployment scheme based on virtual router |
CN107846358A (en) * | 2016-09-19 | 2018-03-27 | 北京金山云网络技术有限公司 | A kind of data transmission method, device and network system |
CN107229492A (en) * | 2017-05-17 | 2017-10-03 | 东软集团股份有限公司 | Installation method, device, system, storage medium and the equipment of server system |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110493227A (en) * | 2019-08-20 | 2019-11-22 | 上海集成电路研发中心有限公司 | A kind of data frame transmission method and system |
CN110493227B (en) * | 2019-08-20 | 2021-12-24 | 上海集成电路研发中心有限公司 | Data frame transmission method and system |
Also Published As
Publication number | Publication date |
---|---|
CN109587083B (en) | 2022-04-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104967585B (en) | A kind of method and apparatus of remote debugging mobile terminal | |
CN110113197A (en) | The method and SDN controller of SDN controller Configuration network equipment | |
CN104468521B (en) | Online moving method, device and system | |
CN100571191C (en) | Keep the VRRP technology of VR confidentiality | |
JPS5935232A (en) | Multiplex communication interface between processor and digital transmission means | |
CN104852828B (en) | A kind of network delay detection method, apparatus and system | |
CN108924050A (en) | Data forwarding method and its device, storage medium and network card equipment | |
CN105893323A (en) | Data reading method and data reading equipment | |
CN105939284B (en) | The matching process and device of message control strategy | |
CN106878194A (en) | A kind of message processing method and device | |
CN110177010B (en) | Link switching method and device | |
CN104767655A (en) | Analog result detection method and device | |
CN109905205A (en) | Data transmission, received method and apparatus, data transmission method and system | |
CN110061855A (en) | A kind of method for processing business, system and device | |
CN110505071A (en) | The method for remote updating of FPGA board, system and relevant apparatus in local area network | |
US7286565B1 (en) | Method and apparatus for packet reassembly in a communication switch | |
CN105933453A (en) | Data transmission method and system | |
CN109587083A (en) | Data transmission method and relevant apparatus | |
CN109327397A (en) | Data transmission, data re-transmitting, data processing method and device | |
CN103442357B (en) | A kind of method and device expanding maximum support number of users | |
CN110505614A (en) | A kind of communication means and device of ZigBee binding switch | |
CN104780106B (en) | More example implementation methods and device | |
CN105471930A (en) | Method, system and equipment for reading distributed data | |
CN102075526B (en) | Soft real-time application-oriented verification system under multi-core virtualized environment | |
CN101312413A (en) | Method for managing application program for network redundancy check |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |