CN110011967A - A kind of method and system for data transmission - Google Patents
A kind of method and system for data transmission Download PDFInfo
- Publication number
- CN110011967A CN110011967A CN201910150101.XA CN201910150101A CN110011967A CN 110011967 A CN110011967 A CN 110011967A CN 201910150101 A CN201910150101 A CN 201910150101A CN 110011967 A CN110011967 A CN 110011967A
- Authority
- CN
- China
- Prior art keywords
- server
- data
- destination client
- communication connection
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/54—Presence management, e.g. monitoring or registration for receipt of user log-on information, or the connection status of the users
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Communication Control (AREA)
Abstract
This application provides a kind of method and systems for data transmission, to solve the problems, such as the communication between the computer in Network Isolation state.A method of it is transmitted for data, comprising: server-side sets first set of words, and is in listening state;Multiple client corresponds respective second socket of setting;Destination client sends communication connection request to the server-side for setting first set of words by the second socket of its own;When the first set of words of server-side listens to communication connection request, the second socket for responding communication connection request and destination client establishes connection;Destination client sends data transfer request to server-side;Server-side searches target data to be transmitted in response to data transfer request, and target data is sent to destination client;Destination client receives target data.So that realizing that connection communication carries out data transmission between two computers in Network Isolation state.
Description
Technical field
This application involves network communication technology fields, more particularly to a kind of method and system for data transmission.
Background technique
Current many equipment and computer based service are necessary to transmit between each other dependent on communication system
Message.The communication system is made of multiple independent communication networks again, including wired and wireless network, all these nets
Network needs coordination with one another, to form one big, interconnection, immanent communication system.For example, internet and mostly
Number commercial network is configured according to TCP/IP architectural model, and (Transmission Control Protocol is passed TCP
Transport control protocol view) it is a kind of connection-oriented, reliable transport layer communication protocol based on byte stream.It is well known that transmitting terminal
With receiving end when being communicated based on Transmission Control Protocol, it is necessary to work in a link layer dependent on physical hardware network interface card, in a network
Connect computer and transmission medium.
But in actual project, the considerations of for factors such as Information Securities, computer can be subjected to Network Isolation,
Even if therefore this kind of computer missing network interface card or this kind of computer have network interface card, but cannot pass through between this kind of computer
Network interface card is communicatively coupled, but is usually communicated again to realize data exchange between this kind of computer.
Summary of the invention
The application provides a kind of method and system for data transmission, to solve to be in the computer of Network Isolation state
Between communication the problem of.
The embodiment of the present disclosure in a first aspect, provide a kind of method for data transmission, be applied to server-side to multiple
The system of client transmissions data, wherein object is established by transmission medium between multiple clients and the server-side
Reason connection, comprising:
The server-side sets first set of words, and the first set of words is in listening state;
Multiple clients correspond respective second socket of setting;
Destination client passes through its own corresponding described second socket to the service for setting the first set of words
End sends communication connection request, wherein the destination client is to be intended to that the server-side is requested to be transmitted in multiple clients
Data one or several;
When the first set of words of the server-side listens to the communication connection request, then the server-side responds institute
Communication connection request is stated, corresponding second socket of the first set of words and the destination client establishes connection, to make
It obtains the destination client and the server-side and communication connection is established by the transmission medium;
The destination client sends data transfer request by described communicate to connect to the server-side;
The server-side searches target data to be transmitted in response to the data transfer request, and described in finding
Target data is sent by described communicate to connect to the destination client;
The destination client receives the target data by the communication connection.
Optionally, after the second socket of the first set of words and the destination client establishes communication connection,
Further include:
The destination client periodically sends heartbeat message to the server-side;
The server-side receives the heartbeat message, and whether just to judge the communication connection according to the heartbeat message
Often;
When the server-side can periodically receive the heartbeat message, then determine that the communication connection is normal;
And
At the end of certain heart beat cycle, the server-side fails to receive the heartbeat message next time, then determines
The communication connection is abnormal, and the server-side destroys the communication connection.
Optionally, when the server-side be receiving end when, the destination client be transmitting terminal, when the server-side be hair
When sending end, the destination client be receiving end;
The method also includes:
The transmitting terminal by it is described communicate to connect to the receiving end send data packet when, calculate and generate the number
It makes a summary according to the first message of packet, and first message abstract is added to the ending of the data packet;
When the receiving end receives the data packet by the communication connection, the first message abstract, weight are intercepted
The second message abstract for newly calculating and generating the data received, verifies the first message abstract and second message abstract
It is whether consistent;If inspection result is consistent, the data received described in expression are the complete data packets, then retain the reception
The data arrived;And if inspection result is inconsistent, the data received described in expression are not the complete data packets, then abandon
The data received.
Optionally, when the server-side be receiving end when, the destination client be transmitting terminal, when the server-side be hair
When sending end, the destination client be receiving end;
The method also includes:
It is communicated to connect after one data packet of receiving end transmission in the transmitting terminal by described, in waiting time
It is interior, receive confirmation message, wherein the confirmation message is to reply to the transmitting terminal after the receiving end receives the data packet
Message;
If the transmitting terminal receives the confirmation message within the waiting time, then next data packet is sent;
If the transmitting terminal fails to receive the confirmation message within the waiting time, then the data packet is retransmitted.
Optionally, the method also includes:
The transmitting terminal retransmits the number of data packet phenomenon according to generation in statistics day part of successional period, if
The number counted within a certain period is greater than preset frequency threshold value, then executes flow control operation;
Wherein, the flow control operation includes:
According to the rule gradually successively decreased, when one data packet of every retransmission, the data volume for retransmitting data packet is reduced
It is a certain amount of, until stopping reducing weight when the number counted in the subsequent period is less than or equal to the frequency threshold value
The new data volume for sending data packet, and carry out data transmission according to the size of the data volume of currently transmitted data packet;
And/or
According to gradually incremental rule, one data packet of every retransmission, the waiting time increases certain time length, described
Stop increasing when waiting time increases to preset maximum value, until the number counted in the subsequent period be less than or
When equal to the frequency threshold value, the waiting time is restored to preset default value.
Optionally, when the server-side be receiving end when, the destination client be transmitting terminal, when the server-side be hair
When sending end, the destination client be receiving end;
The method also includes:
When the transmitting terminal sends multiple data packets to the receiving end, serial number is added for each data packet;
When the receiving end receives multiple data packets, multiple data packets are arranged according to the serial number.
Optionally, the method also includes:
The client is sent to the server-side closes connection notice, and the server-side connects logical in response to the closing
Know and disconnects the communication connection;Or
The server-side disconnects the communication connection after being all sent completely the data packet of all target datas.
Optionally, before the server-side sets first set of words, further includes:
Define the interface instance of the transmission medium;
And be registered to the interface instance respectively in the operating system of the server-side and the client, so that described
It is coupled between server-side and the client by the interface instance.
Correspondingly, the second aspect of the embodiment of the present disclosure, additionally provides a kind of system for data transmission, comprising:
Server-side, multiple client and transmission medium;
The server-side and multiple clients establish physical connection by the transmission medium;
The server-side sets first set of words, and the first set of words is in listening state;
Multiple clients correspond respective second socket of setting;
Destination client passes through its own corresponding described second socket to the service for setting the first set of words
End sends communication connection request, wherein the destination client is to be intended to that the server-side is requested to be transmitted in multiple clients
Data one or several;
When the first set of words of the server-side listens to the communication connection request, then the server-side responds institute
Communication connection request is stated, corresponding second socket of the first set of words and the destination client establishes connection, to make
It obtains the destination client and the server-side and communication connection is established by the transmission medium;
The destination client sends data transfer request by described communicate to connect to the server-side;
The server-side searches target data to be transmitted in response to the data transfer request, and described in finding
Target data is sent by described communicate to connect to the destination client;
The destination client receives the target data by the communication connection.
Compared with prior art, the application can at least reach following technical effect:
In actual project, the considerations of for factors such as Information Securities, computer can be subjected to Network Isolation, when two
Platform is in when needing to carry out communication interaction between the computer of Network Isolation state, chooses the computer of transmission data as service
The computer for receiving data is chosen as destination client in end.First set of words is set for server-side, and monitors the first socket
Word sets the second socket for client, and destination client passes through its own corresponding second socket to the first of server-side
Socket sends communication connection request, and when first set of words listens to the communication connection request, then server-side responds the communication link
Request is connect, corresponding second socket of first set of words and destination client establishes connection, so that the destination client
It is established and is communicated to connect by the transmission medium with the server-side, destination client can request server-side to start data biography
Defeated target data, server-side responds the data transfer request and finds corresponding data, and sends to client, and client receives
Target data.According to this, by the method disclosed in the present application for data transmission, so that this two computers are built into C/S frame
Structure (i.e. Client/Server framework, i.e. user terminal/server framework), so that two are in the meter of Network Isolation state
Realize that connection communication carries out data transmission between calculation machine.
Other feature and advantage of the disclosure will the following detailed description will be given in the detailed implementation section.
Detailed description of the invention
Fig. 1 is a kind of schematic diagram for system for data transmission that one embodiment of the application provides;
Fig. 2 is a kind of flow chart for method for data transmission that one embodiment of the application provides;
Fig. 3 is that a kind of encoding model of the communication protocol for method for data transmission that one embodiment of the application provides shows
It is intended to;
Fig. 4 is a kind of three-layer network mould of the communication protocol for method for data transmission that one embodiment of the application provides
Type;
Fig. 5 is a kind of three-layer network mould of the communication protocol for method for data transmission that one embodiment of the application provides
Data flow schematic diagram in type;
Fig. 6 is a kind of the exemplary of the flow control mechanism for method for data transmission that one embodiment of the application provides
Model;
Fig. 7 is that a kind of destination client for method for data transmission that one embodiment of the application provides is built with server-side
The single handshake procedure schematic diagram of vertical communication connection;
Fig. 8 is that a kind of destination client for method for data transmission that one embodiment of the application provides is initiated and serviced
End disconnects the single handshake procedure schematic diagram of communication connection and server-side initiates the list that communication connection is disconnected with destination client
Secondary handshake procedure schematic diagram.
Specific embodiment
In order to make the above objects, features, and advantages of the present application more apparent, with reference to the accompanying drawing and it is specific real
Applying mode, the present application will be further described in detail.
The disclosure provides a kind of method for data transmission, is to multiple client transmission data applied to server-side
System, referring to Fig. 1, the system can be multiple computers, (in Network Isolation state, computer hereinafter is place
In the computer of Network Isolation state) physical connection is established by transmission medium between any two, wherein and transmission medium is, for example,
Other data transmission cables, the application such as USB ferry-boat cable, Serial Port Line are not particularly limited.In the system, when wherein certain
One or several computers need to transmit to a certain other computer request data, then the calculating as data sender
Machine is exactly server-side, and the computer as data receiver is exactly client.In Fig. 1, multiple calculating are illustratively illustrated
Machine establishes physical connection by transmission medium, and only using the computer in center in figure as server-side 101, remaining computer is
Client 102, but this is not concrete restriction, is also possible to other computers as server-side, correspondingly, other remaining calculating
Machine is as client.Physical connection is established by transmission medium between multiple clients 102 and the server-side 101.
Please refer to Fig. 1 and Fig. 2, which comprises
S101, the server-side sets first set of words, and the first set of words is in listening state;
S102, multiple clients correspond respective second socket of setting;
S103, destination client is by its own corresponding described second socket to setting the first set of words
Server-side sends communication connection request, wherein the destination client is to be intended to request the server-side in multiple clients
Transmit one or several of data;
S104, when the first set of words of the server-side listens to the communication connection request, then the server-side
The communication connection request is responded, corresponding second socket of the first set of words and the destination client establishes connection,
So that the destination client and the server-side are established by the transmission medium and are communicated to connect;
S105, the destination client send data transfer request by described communicate to connect to the server-side;
S106, the server-side searches target data to be transmitted in response to the data transfer request, and will find
The target data by it is described communicate to connect to the destination client send;
S107, the destination client receive the target data by the communication connection.
The code of the communication protocol of this data transmission method is illustratively shown below, and is illustrated:
1, server-side establishes code:
2, client code:
The above coding illustrates the communication protocol based on the present processes, is applied to server-side and transmits to multiple client
The system of data, encoding model are as shown in Figure 3.It, can will the considerations of for factors such as Information Securities in actual project
Computer carries out Network Isolation, when needing to carry out communication interaction between two computers in Network Isolation state, chooses
The computer of data is transmitted as server-side, chooses the computer for receiving data as destination client.
When client is communicated with server-side, server-side is initialized first, sets first set of words for server-side, i.e.,
It communicates title " TEST ", and the first set of words is initially located in listening state, monitors network state in real time, and service at this time
For the first set of words at end when monitoring, the data that server-side reading client from inlet flow sends over are block type operations,
Until the first set of words listens to communication connection request.Setting respective second is corresponded simultaneously for multiple client
Socket.For ease of description, it is only illustrated so that a client initiates access to server-side as an example herein, but is not to this
The limitation of application, the process for initiating access for multiple client is similar, and those skilled in the art, which are easy to analogize, to be known, therefore
It repeats no more.
Existing certain computer (i.e. destination client) needs to obtain data from server-side in all computers, then target
Corresponding second socket of client proposes connection request, and the target to be connected is the first set of words of server-side.Target thus
Second socket of client describes the first set of words for the server that it needs to connect first, and mentions to the first set of words
Connection request out, when the first set of words of server-side listens to corresponding second socket in (or receiving) destination client
Connection request, the first set of words establish a new thread in response to the connection request, the first socket of server-side
Destination client is issued in the description of word, once destination client confirmed this description, connection is just established, destination client and
Server-side also just establishes communication connection by transmission medium.And the first set of words of server-side keeps listening state, after
The connection request of the second socket of other clients is received in continued access.Destination service end can start to request server-side transmission data,
Server-side responds the request and finds target data and send to destination client, and destination client receives target data, thus
Realize two communication between Network Isolation state machines.
According to this, by the method disclosed in the present application for data transmission, so that this two computers are built into C/S framework
(i.e. Client/Server framework, i.e. user terminal/server framework), so that two are in the calculating of Network Isolation state
Realize that connection communication carries out data transmission between machine.
When the server-side be receiving end when, the destination client be transmitting terminal, when the server-side is transmitting terminal,
The destination client is receiving end.As shown in figure 4, being needed based on the method that the communication protocol will realize above-mentioned data transmission
Want three levels: underlying transport, secure transport layers and application layer.Wherein, the major function of underlying transport is the service of establishing
The connection at end and destination client guarantees that can be carried out communication connection between host side and end carries out data transmission;Secure transport layers
Major function be to control the flow of data transmission, sequence etc. of data transmission, when guaranteeing data transmission can in time, it is quasi-
Really and receiving end effectively is transferred to from transmitting terminal;Application layer is the entity both sides for actually needing to communicate, that is, needs to communicate
Server end and client.Wherein Fig. 5 is referred in the specific flow direction of transmitting terminal and reception end data.
In an exemplary embodiment, before step S101, the server-side setting first set of words, further includes:
Define the interface instance of the transmission medium;
And be registered to the interface instance respectively in the operating system of the server-side and the client, so that described
It is coupled between server-side and the client by the interface instance.
Incorporated by reference to referring to Fig. 3 and Fig. 4, first set of words and destination client setting second are set in the server-side
Before socket, initial transmission medium is needed.Firstly, the interface instance of transmission medium is defined, by taking USB ferries cable as an example,
Code is as follows:
IEngine engine=new USBEngine ();// it is initialized a transmission medium using USB ferry-boat line
Interface
It indicates for the interface instance of transmission medium to be defined as the engine interface example using USB ferry-boat line;
Then by defining interface example, i.e. the engine interface example of USB ferry-boat line is registered to underlying transport, and code is such as
Under:
BaseTransfer.AddEngine(engine);// registration transmission medium engine instance
After registration, mean that the data of communicating pair can mutually be transmitted by this engine.This note
Volume process needs to carry out before actually establishing communication connection, and only needs to register primary.
And when defining the interface instance of transmission medium, function can be defined as follows:
event Action<string,byte[]>OnReceive;// message arrival event
string GetUniqueKey();// return to engine uniquely tagged
void Write(byte[]data);// write-in data
With superior function be the communication protocol to realize the transmission of above-mentioned data method when the transmitting-receiving of the bottom that uses connect
Mouth function.
In an exemplary embodiment, in step S104, the second of the first set of words and the destination client
Socket is established after communication connection, further includes:
The destination client periodically sends heartbeat message to the server-side;
The server-side receives the heartbeat message, and whether just to judge the communication connection according to the heartbeat message
Often;
When the server-side can periodically receive the heartbeat message, then determine that the communication connection is normal;
And
At the end of certain heart beat cycle, the server-side fails to receive the heartbeat message next time, then determines
The communication connection is abnormal, and the server-side destroys the communication connection.
Referring to figure 4., underlying transport increases heartbeat mechanism, for judging whether physical connection is normal;In target visitor
After family end and server-side set up communication connection, destination client periodically starts to send heartbeat message to server-side
(Heartbeat Message), until destination client actively disconnects the communication connection.Server-side starts reception heartbeat and disappears
Breath, when server-side does not receive message (i.e. at the end of some heart beat cycle) within some message sink period, server-side thinks mesh
Mark client has been switched off or communicates to connect failure or is currently unavailable, and server-side destruction is somebody's turn to do and destination client
Communication connection reduce communication connections redundancy to discharge resource.
In one exemplary embodiment, when the server-side be receiving end when, the destination client be transmitting terminal, work as institute
State server-side when being transmitting terminal, the destination client is receiving end;
The method also includes:
The transmitting terminal by it is described communicate to connect to the receiving end send data packet when, calculate and generate the number
It makes a summary according to the first message of packet, and first message abstract is added to the ending of the data packet;
When the receiving end receives the data packet by the communication connection, the first message abstract, weight are intercepted
The second message abstract for newly calculating and generating the data received, verifies the first message abstract and second message abstract
It is whether consistent;If inspection result is consistent, the data received described in expression are the complete data packets, then retain the reception
The data arrived;And if inspection result is inconsistent, the data received described in expression are not the complete data packets, then abandon
The data received.
Referring to figure 4., consistency verification of data mechanism is also set in underlying transport, is transmitted in transmitting terminal to receiving end
When data, transmitting terminal can calculate and generate the MD5 value of data to be sent first, and the MD5 value is added to data to be sent
Ending, wherein the MD in MD5 represents Message Digest, is exactly the meaning of eap-message digest, but this eap-message digest is not
The abbreviation of message content, but according to disclosed MD5 algorithm to one 128 obtained after the progress mathematic(al) manipulation of former message
(bit) condition code.After receiving end receives data, the MD5 value of ending is intercepted, and recalculates the data for generating and receiving
New MD5 value, member MD5 value and new MD5 value are compared, if self-consistent, illustrate that received data are complete;
If inconsequent, illustrate that received data are imperfect, the data received are abandoned.
In one exemplary embodiment, when the server-side be receiving end when, the destination client be transmitting terminal, work as institute
State server-side when being transmitting terminal, the destination client is receiving end;
The method also includes:
It is communicated to connect after one data packet of receiving end transmission in the transmitting terminal by described, in waiting time
It is interior, receive confirmation message, wherein the confirmation message is to reply to the transmitting terminal after the receiving end receives the data packet
Message;
If the transmitting terminal receives the confirmation message within the waiting time, then next data packet is sent;
If the transmitting terminal fails to receive the confirmation message within the waiting time, then the data packet is retransmitted.
Referring to figure 4., Retransmission timeout mechanism is set in secure transport layers, to guarantee that each data packet can be from transmitting terminal
It is sent to receiving end, and is stored in the reception buffer area of receiving end.After transmitting terminal sends data packet to receiving end, into etc.
To state, and starts reception confirmation message and continue to send next number if receiving confirmation message within the waiting time
According to packet;If not receiving confirmation message within the waiting time, transmitting terminal thinks that the data packet may have lost, and sends out again
The data packet sent just now is sent, until continuing to send next data packet after receiving the confirmation message that receiving end is replied.Time-out
Re-transmission may result in receiving end and receive duplicate data packet, therefore receiving end needs to judge whether data packet repeats, if weight
It is multiple, then it abandons.
Optionally, the method also includes:
The transmitting terminal retransmits the number of data packet phenomenon according to generation in statistics day part of successional period, if
The number counted within a certain period is greater than preset frequency threshold value, then executes flow control operation;
Wherein, the flow control operation includes:
According to the rule gradually successively decreased, when one data packet of every retransmission, the data volume for retransmitting data packet is reduced
It is a certain amount of, until stopping reducing weight when the number counted in the subsequent period is less than or equal to the frequency threshold value
The new data volume for sending data packet, and carry out data transmission according to the size of the data volume of currently transmitted data packet;
And/or
According to gradually incremental rule, one data packet of every retransmission, the waiting time increases certain time length, described
Stop increasing when waiting time increases to preset maximum value, until the number counted in the subsequent period be less than or
When equal to the frequency threshold value, the waiting time is restored to preset default value.
Referring to figure 4., flow control mechanism is set in secure transport layers, unstable or upper layer occurs when bottom connects
It is excessive to establish connection, data transmission delay is caused to increase, confirmation message reaches after waiting time, so as to cause a large amount of super
Shi Chongchuan data packet is stacked into network.Therefore, in order to solve this problem, flow control is increased, i.e., very frequent
After Retransmission timeout occurs, by way of being progressively decreased the data volume of re-transmission, increasing the time of Retransmission timeout, to solve to ask
Topic.Specifically, illustrating so that two clients initiate request to server-side simultaneously as an example, but this is not the limitation to the application, only
The exemplary illustration for being in order to facilitate understanding and carrying out.
Fig. 6 is referred to, customer end A, B establish communication connection with server-side S, at this point, customer end A, B are transmitting terminal,
Server-side is receiving end.And knows the transmission delay of transmission medium (transmission delay of transmission medium is by itself property institute for D1
Determine, can be obtained by test, non-the application problem to be solved repeats no more), by the Retransmission timeout time (when waiting
It is long) setting are as follows: 2 × D1+20 milliseconds, therefore, the confirmation message (ACK) that server-side is replied has time enough when network is unobstructed
Customer end A and/or B can be fed back to.If data are not lost in transmission process, then Retransmission timeout phenomenon will not occur.
But if there is following two situation, may result in Retransmission timeout phenomenon and frequently occur, the first, transmission medium goes out
Problem, such as media ages, media hardware failure etc.;Second, customer end A, B transmitted data amount have been more than transmission medium
Maximum bandwidth, such as A are ready for sending data and give server-side S, but customer end B is transmitting mass data at this time, will transmission
Medium bandwidth takes, and the data that customer end A is sent necessarily have delay, eventually results in customer end A and receives server-side S reply
The time of ACK has been over the Retransmission timeout time, and A can send data to server-side S again, causes to transmit a large amount of repeat numbers
According to this certainly will will cause communication connection line redundancy, occupy a large amount of transmission medium bandwidths, waste of resource.
Therefore it is solved the above problems by flow control mechanism.Customer end A and B are according to statistics day part of successional period
The interior number for occurring to retransmit data packet phenomenon, if the number that customer end A counts within a certain period is greater than in advance
If frequency threshold value, then illustrate that present network is bad, then customer end A will take following measure:
1, Retransmission timeout data volume is reduced.Customer end A still carries out Retransmission timeout, but by the data volume of Retransmission timeout by
Decrescence few, according to the rule gradually successively decreased, when one data packet of every retransmission, the data volume for retransmitting data packet reduces one
It is quantitative, be reduced to always a minimum value (such as when normal Retransmission timeout 100K data, retransmit the data of 50K now, it is lower
Secondary re-transmission 20K etc.), mitigate transmission medium pressure, facilitates data and reach server-side S in time, to reduce number of retransmissions.Until
When the number that customer end A counts in the subsequent period is less than or equal to the frequency threshold value, customer end A stops reducing
The data volume of data packet is retransmitted, and is carried out data transmission according to the size of the data volume of currently transmitted data packet.
2, increase the Retransmission timeout time.Customer end A can gradually increase the Retransmission timeout time of oneself, according to what is be gradually incremented by
Rule, one data packet of every retransmission, the waiting time increases certain time length, until a maximum value;If network is extensive
It is multiple, until when the number counted in the subsequent period is less than or equal to the frequency threshold value, by the waiting time
Restore to preset default value.
By the above measure, number of retransmissions is reduced, mitigates transmission medium pressure.
In one exemplary embodiment, when the server-side be receiving end when, the destination client be transmitting terminal, work as institute
State server-side when being transmitting terminal, the destination client is receiving end;
The method also includes:
When the transmitting terminal sends multiple data packets to the receiving end, serial number is added for each data packet;
When the receiving end receives multiple data packets, multiple data packets are arranged according to the serial number.
Fig. 4 is referred to, also sets data sequential control mechanism in secure transport layers, secure transport layers need to guarantee data
Behind transmitting terminal arrival receiving end, data sequence will be consistent, cannot be out-of-order.In order to solve this problem, it is based on the application
The method for being used for transmission data communication protocol in, the data packet of each transmission is numbered in transmitting terminal, presses in receiving end
Data are submitted to upper layer (application layer) according to number, to guarantee the consistency of data sequence.
In one exemplary embodiment, the method also includes:
The client is sent to the server-side closes connection notice, and the server-side connects logical in response to the closing
Know and disconnects the communication connection;Or
The server-side disconnects the communication connection after being all sent completely the data packet of all target datas.
Continuing with the connection setup process that referring to Fig. 3, destination client is connect with server-side:
Description through the foregoing embodiment, due to agreement based on transmission medium it is more stable, when establishing connection only
It is shaken hands using single, is shown in conjunction with Fig. 7.That is: it after client (Client) sends communication connection request, starts waiting;Server-side
(Server) after receiving client communication connection request, feedback link confirmation message;Client is within the defined waiting time
If receiving the connection confirmation message of server-side feedback, establishes and communicate to connect successfully;If confiscating connection confirmation message,
Communication connection failure.If client reaches exactly to the waiting time after server feedback connection confirmation message, then objective at this time
Communication connection failure is thought at family end, but server-side think connection it has been established that in this case, the communication link of server-side maintenance
The heartbeat message that can not receive client transmission is connect, therefore after heartbeat timeout, server-side can the auto-destruct connection.
Destination client and server-side communicate to connect disconnection process:
The process for disconnecting communication connection is also shaken hands using single, is shown in conjunction with Fig. 8.Client, server-side either side are all
Function interface can be actively called to disconnect communication connection.When physical link failure, indicate that the data packet of heartbeat message can not pass
It is sent to other side, after a heartbeat timeout, the connection at both ends also be will disconnect.
Function interface is called to disconnect communications connection procedure, it is directly disconnected after initiation direction other side transmission disconnects data packet
The connection for opening oneself does not need the feedback message for receiving other side.Other side receives disconnect data packet after, be immediately performed disconnection
Connection procedure disconnects.Wherein, initiator can be client and be also possible to server-side.When initiator is server-side, inciting somebody to action
The data packet of all target datas calls function interface to disconnect communication connection after being all sent completely, and initiator is client
When, call function interface to disconnect communication link behind buffer area all receiving and storing the data packet of all target datas
It connects.
Illustrate, in the communication protocol of the method for being used for transmission data of the application, transmitting terminal and receiving end it
Between transmission data packet format it is as shown in the table:
The disclosure additionally provides a kind of system for data transmission, comprising:
Server-side, multiple client and transmission medium;
The server-side and multiple clients establish physical connection by the transmission medium;
The server-side sets first set of words, and the first set of words is in listening state;
Multiple clients correspond respective second socket of setting;
Destination client passes through its own corresponding described second socket to the service for setting the first set of words
End sends communication connection request, wherein the destination client is to be intended to that the server-side is requested to be transmitted in multiple clients
Data one or several;
When the first set of words of the server-side listens to the communication connection request, then the server-side responds institute
Communication connection request is stated, corresponding second socket of the first set of words and the destination client establishes connection, to make
It obtains the destination client and the server-side and communication connection is established by the transmission medium;
The destination client sends data transfer request by described communicate to connect to the server-side;
The server-side searches target data to be transmitted in response to the data transfer request, and described in finding
Target data is sent by described communicate to connect to the destination client;
The destination client receives the target data by the communication connection.
For system embodiments, since it is basically similar to the method embodiment, related so being described relatively simple
Place illustrates referring to the part of embodiment of the method.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with
The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
Above to a kind of method and system for data transmission provided herein, it is described in detail, herein
In apply specific case the principle and implementation of this application are described, the explanation of above example is only intended to sides
Assistant solves the present processes and its core concept;At the same time, for those skilled in the art, the think of according to the application
Think, there will be changes in the specific implementation manner and application range, in conclusion the content of the present specification should not be construed as pair
The limitation of the application.
Claims (9)
1. a kind of method for data transmission, the system for transmitting data to multiple client applied to server-side, wherein multiple
Physical connection is established by transmission medium between the client and the server-side characterized by comprising
The server-side sets first set of words, and the first set of words is in listening state;
Multiple clients correspond respective second socket of setting;
It is sent out by its own corresponding described second socket to the server-side for setting the first set of words destination client
Send communication connection request, wherein the destination client is to be intended to request the server-side transmission data in multiple clients
One or several;
When the first set of words of the server-side listens to the communication connection request, then the server-side response is described logical
Believe connection request, corresponding second socket of the first set of words and the destination client establishes connection, so that institute
It states destination client and the server-side and communication connection is established by the transmission medium;
The destination client sends data transfer request by described communicate to connect to the server-side;
The server-side searches target data to be transmitted, and the target that will be found in response to the data transfer request
Data are sent by described communicate to connect to the destination client;
The destination client receives the target data by the communication connection.
2. the method according to claim 1, wherein the of the first set of words and the destination client
Two sockets are established after communication connection, further includes:
The destination client periodically sends heartbeat message to the server-side;
The server-side receives the heartbeat message, and judges whether the communication connection is normal according to the heartbeat message;
When the server-side can periodically receive the heartbeat message, then determine that the communication connection is normal;
And
At the end of certain heart beat cycle, the server-side fails to receive the heartbeat message next time, then described in judgement
Communication connection is abnormal, and the server-side destroys the communication connection.
3. the method according to claim 1, wherein when the server-side is receiving end, the target customer
End is transmitting terminal, when the server-side is transmitting terminal, the destination client be receiving end;
The method also includes:
The transmitting terminal by it is described communicate to connect to the receiving end send data packet when, calculate and generate the data packet
First message abstract, and first message abstract is added to the ending of the data packet;
When the receiving end receives the data packet by the communication connection, the first message abstract is intercepted, is counted again
The second message abstract for calculating and generating the data received, verifies the first message abstract and whether the second message makes a summary
Unanimously;If inspection result is consistent, the data received described in expression are the complete data packets, then receive described in reservation
Data;And if inspection result is inconsistent, the data received described in expression are not the complete data packets, then abandon described in
The data received.
4. the method according to claim 1, wherein when the server-side is receiving end, the target customer
End is transmitting terminal, when the server-side is transmitting terminal, the destination client be receiving end;
The method also includes:
It is communicated to connect after one data packet of receiving end transmission in the transmitting terminal by described, within waiting time, is connect
Receive confirmation message, wherein the confirmation message is to reply to disappearing for the transmitting terminal after the receiving end receives the data packet
Breath;
If the transmitting terminal receives the confirmation message within the waiting time, then next data packet is sent;
If the transmitting terminal fails to receive the confirmation message within the waiting time, then the data packet is retransmitted.
5. according to the method described in claim 4, it is characterized in that, the method also includes:
The transmitting terminal is according to the number that retransmission data packet phenomenon occurs in statistics day part of successional period, if at certain
The number counted in one period is greater than preset frequency threshold value, then executes flow control operation;
Wherein, the flow control operation includes:
According to the rule gradually successively decreased, when one data packet of every retransmission, retransmit data packet data volume reduce it is certain
Amount, until stopping reducing and send out again when the number counted in the subsequent period is less than or equal to the frequency threshold value
The data volume of data packet is sent, and is carried out data transmission according to the size of the data volume of currently transmitted data packet;
And/or
According to gradually incremental rule, one data packet of every retransmission, the waiting time increases certain time length, the waiting
Duration stops increasing when increasing to preset maximum value, until the number counted in the subsequent period is less than or equal to
When the frequency threshold value, the waiting time is restored to preset default value.
6. the method according to claim 1, wherein when the server-side is receiving end, the target customer
End is transmitting terminal, when the server-side is transmitting terminal, the destination client be receiving end;
The method also includes:
When the transmitting terminal sends multiple data packets to the receiving end, serial number is added for each data packet;
When the receiving end receives multiple data packets, multiple data packets are arranged according to the serial number.
7. according to claim 1 to method described in 6 any one, which is characterized in that the method also includes:
The client is sent to the server-side closes connection notice, and the server-side is disconnected in response to closing connection notice
Open the communication connection;Or
The server-side disconnects the communication connection after being all sent completely the data packet of all target datas.
8. according to claim 1 to method described in 6 any one, which is characterized in that in the first socket of server-side setting
Before word, further includes:
Define the interface instance of the transmission medium;
And be registered to the interface instance respectively in the operating system of the server-side and the client, so that the service
It is coupled between end and the client by the interface instance.
9. a kind of system for data transmission characterized by comprising
Server-side, multiple client and transmission medium;
The server-side and multiple clients establish physical connection by the transmission medium;
The server-side sets first set of words, and the first set of words is in listening state;
Multiple clients correspond respective second socket of setting;
It is sent out by its own corresponding described second socket to the server-side for setting the first set of words destination client
Send communication connection request, wherein the destination client is to be intended to request the server-side transmission data in multiple clients
One or several;
When the first set of words of the server-side listens to the communication connection request, then the server-side response is described logical
Believe connection request, corresponding second socket of the first set of words and the destination client establishes connection, so that institute
It states destination client and the server-side and communication connection is established by the transmission medium;
The destination client sends data transfer request by described communicate to connect to the server-side;
The server-side searches target data to be transmitted, and the target that will be found in response to the data transfer request
Data are sent by described communicate to connect to the destination client;
The destination client receives the target data by the communication connection.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910150101.XA CN110011967A (en) | 2019-02-27 | 2019-02-27 | A kind of method and system for data transmission |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910150101.XA CN110011967A (en) | 2019-02-27 | 2019-02-27 | A kind of method and system for data transmission |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110011967A true CN110011967A (en) | 2019-07-12 |
Family
ID=67166080
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910150101.XA Pending CN110011967A (en) | 2019-02-27 | 2019-02-27 | A kind of method and system for data transmission |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110011967A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110958264A (en) * | 2019-12-13 | 2020-04-03 | 电子科技大学中山学院 | Server communication method based on TCP/IP protocol |
CN111935827A (en) * | 2020-06-30 | 2020-11-13 | 王柳渝 | Wireless communication video data transmission method and system |
CN113079105A (en) * | 2021-03-30 | 2021-07-06 | 联芸科技(杭州)有限公司 | Data transmission method, system, computer device and medium |
CN114979305A (en) * | 2022-06-30 | 2022-08-30 | 京东方科技集团股份有限公司 | Communication method, device, equipment, storage medium and program product |
CN116112290A (en) * | 2023-04-10 | 2023-05-12 | 北京长亭未来科技有限公司 | Flow transfer method and device applied to Web centralized management system |
CN116450380A (en) * | 2023-06-09 | 2023-07-18 | 北京集度科技有限公司 | Message processing method, electronic equipment and computer readable storage medium |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101272402A (en) * | 2008-05-14 | 2008-09-24 | 深圳市同洲电子股份有限公司 | Method, system and device for data transmission |
CN102546832A (en) * | 2012-02-29 | 2012-07-04 | 北京快网科技有限公司 | Message transmission method based on transmission control protocol (TCP) |
CN102752575A (en) * | 2011-11-30 | 2012-10-24 | 新奥特(北京)视频技术有限公司 | Method for monitoring processing effect of special effect processing system in real time through editing system |
CN103036904A (en) * | 2012-12-27 | 2013-04-10 | 东方通信股份有限公司 | Method of data reliable transmission with user datagram protocol (UDP) in communication network |
CN104410587A (en) * | 2014-11-13 | 2015-03-11 | 京信通信系统(中国)有限公司 | Method and device for controlling capacity of receive buffer zone |
CN105530686A (en) * | 2015-12-22 | 2016-04-27 | 西安大唐电信有限公司 | Intelligent vehicle terminal access realizing method based on UDP |
CN105553977A (en) * | 2015-12-15 | 2016-05-04 | 网易(杭州)网络有限公司 | Request message processing and transmitting method and device |
CN106254179A (en) * | 2016-08-05 | 2016-12-21 | 深圳先进技术研究院 | A kind of heartbeat packet asynchronous controlling method and device |
CN107070613A (en) * | 2017-03-22 | 2017-08-18 | 公安部交通管理科学研究所 | Reliable data transmission method under distributed network environment |
CN107204834A (en) * | 2017-05-25 | 2017-09-26 | 复旦大学 | A kind of control method of the express network transmitting based on UDT agreements |
US20180287951A1 (en) * | 2017-04-04 | 2018-10-04 | Netapp, Inc. | Intelligent thread management across isolated network stacks |
-
2019
- 2019-02-27 CN CN201910150101.XA patent/CN110011967A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101272402A (en) * | 2008-05-14 | 2008-09-24 | 深圳市同洲电子股份有限公司 | Method, system and device for data transmission |
CN102752575A (en) * | 2011-11-30 | 2012-10-24 | 新奥特(北京)视频技术有限公司 | Method for monitoring processing effect of special effect processing system in real time through editing system |
CN102546832A (en) * | 2012-02-29 | 2012-07-04 | 北京快网科技有限公司 | Message transmission method based on transmission control protocol (TCP) |
CN103036904A (en) * | 2012-12-27 | 2013-04-10 | 东方通信股份有限公司 | Method of data reliable transmission with user datagram protocol (UDP) in communication network |
CN104410587A (en) * | 2014-11-13 | 2015-03-11 | 京信通信系统(中国)有限公司 | Method and device for controlling capacity of receive buffer zone |
CN105553977A (en) * | 2015-12-15 | 2016-05-04 | 网易(杭州)网络有限公司 | Request message processing and transmitting method and device |
CN105530686A (en) * | 2015-12-22 | 2016-04-27 | 西安大唐电信有限公司 | Intelligent vehicle terminal access realizing method based on UDP |
CN106254179A (en) * | 2016-08-05 | 2016-12-21 | 深圳先进技术研究院 | A kind of heartbeat packet asynchronous controlling method and device |
CN107070613A (en) * | 2017-03-22 | 2017-08-18 | 公安部交通管理科学研究所 | Reliable data transmission method under distributed network environment |
US20180287951A1 (en) * | 2017-04-04 | 2018-10-04 | Netapp, Inc. | Intelligent thread management across isolated network stacks |
CN107204834A (en) * | 2017-05-25 | 2017-09-26 | 复旦大学 | A kind of control method of the express network transmitting based on UDT agreements |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110958264A (en) * | 2019-12-13 | 2020-04-03 | 电子科技大学中山学院 | Server communication method based on TCP/IP protocol |
CN111935827A (en) * | 2020-06-30 | 2020-11-13 | 王柳渝 | Wireless communication video data transmission method and system |
CN113079105A (en) * | 2021-03-30 | 2021-07-06 | 联芸科技(杭州)有限公司 | Data transmission method, system, computer device and medium |
CN114979305A (en) * | 2022-06-30 | 2022-08-30 | 京东方科技集团股份有限公司 | Communication method, device, equipment, storage medium and program product |
CN114979305B (en) * | 2022-06-30 | 2024-03-22 | 京东方科技集团股份有限公司 | Communication method, device, equipment, storage medium and program product |
CN116112290A (en) * | 2023-04-10 | 2023-05-12 | 北京长亭未来科技有限公司 | Flow transfer method and device applied to Web centralized management system |
CN116450380A (en) * | 2023-06-09 | 2023-07-18 | 北京集度科技有限公司 | Message processing method, electronic equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110011967A (en) | A kind of method and system for data transmission | |
US6954797B1 (en) | Data Communication method, terminal equipment, interconnecting installation, data communication system and recording medium | |
US7672223B2 (en) | Method and apparatus for replicating a transport layer protocol stream | |
JP4164365B2 (en) | Technology for improving TCP performance over a wireless interface by providing a dual proxy device | |
CN102368700B (en) | Transmission method of massages in distributed system | |
EP1206062A2 (en) | Data communication system, data communication method, and recording medium with data communication program recorded thereon | |
WO2001047206A2 (en) | Changing xid/pdcp parameters during connection | |
WO2007093087A1 (en) | A synchronization method of connection status in data communications and the applied communication node | |
EP2613497B1 (en) | Method of transporting data in a sub-segmented manner | |
WO2021128602A1 (en) | Data transmission method and apparatus | |
US6751188B1 (en) | Method and apparatus for a graceful controller switchover | |
JP2006279467A (en) | Communication apparatus and fault detecting method in logical link | |
CN106101026A (en) | A kind of UDP multicasting method of highly reliable low latency | |
KR101587332B1 (en) | Method for checking connectivity between controllers and network apparatuses | |
CN111464514A (en) | TCP hot backup method and system | |
JP2001308936A (en) | Data communication method, repeater, data communication system and its recording medium | |
JPH05122278A (en) | Terminal control system for exchange | |
JPH11168525A (en) | Data communication method and data communication equipment | |
JP3301590B2 (en) | Protocol state synchronization system | |
JPH08298535A (en) | Osi communication system | |
CN110768824B (en) | Hybrid network system and communication connection establishment method thereof | |
JP2003229900A (en) | Repeat processor and its method | |
CN111818573B (en) | Air-to-ground ACARS message transmission method and system based on file transmission | |
CN110351031B (en) | Method for communication between charging site side and charging management platform side | |
KR20100026721A (en) | Apparatus and method for providing network interface information in stream control transmission protocol |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190712 |