CN105610836B - A kind of method and system of data transmission - Google Patents

A kind of method and system of data transmission Download PDF

Info

Publication number
CN105610836B
CN105610836B CN201511025486.5A CN201511025486A CN105610836B CN 105610836 B CN105610836 B CN 105610836B CN 201511025486 A CN201511025486 A CN 201511025486A CN 105610836 B CN105610836 B CN 105610836B
Authority
CN
China
Prior art keywords
file
field
message
client
server
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.)
Active
Application number
CN201511025486.5A
Other languages
Chinese (zh)
Other versions
CN105610836A (en
Inventor
练军
许军进
周明
沈乐平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN201511025486.5A priority Critical patent/CN105610836B/en
Publication of CN105610836A publication Critical patent/CN105610836A/en
Application granted granted Critical
Publication of CN105610836B publication Critical patent/CN105610836B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0815Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Communication Control (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a kind of method and system of data transmission, are related to field of communication technology, and wherein method includes: the request for establishing TCP connection that server-side receives client transmission, establish TCP connection with client;After TCP connection foundation, client uploads files to server end by TCP connection;Wherein, a TCP connection is created when transmitting single file;Multiple TCP connections, multiple file cocurrent transmission are created when transmitting multiple files.The method and system of data transmission of the invention, when transmitting multiple files, it can support to create multiple TCP connection concurrent transmissions, provide File Transfer Protocol, it can be used as file coffret, and support long connection and two kinds of connection types of short connection, it being capable of high efficiency of transmission file, efficiency of transmission is effectively improved, resources occupation rate is reduced.

Description

A kind of method and system of data transmission
Technical field
The present invention relates to the method and system that field of communication technology more particularly to a kind of data transmit.
Background technique
At full speed with social economy, video monitoring system is an important composition portion in security precautions technology system Point, there is unique effect in all trades and professions, currently, the system is exceedingly fast in China's development, Market competition.File transmission is made For an important module of system, it is necessary to assure the efficiency of transmission of file and the integrality of data and safety.It is used at present Ftp file transfer protocol has the shortcomings that obvious --- on transmission file, need complicated exchange to shake hands, so as to cause efficiency Lowly, and a file is sent, at least needs to create two socket connections, and leading portion equipment is frequently in large quantities to text Part management server sends file, occupies a large amount of resource, it is clear that undesirable.As the point scale of system monitoring constantly increases Add, the performance of FTP mode concurrent transmission file resource has encountered bottleneck, and the present invention has well solved the performance issue, mentioned The high concurrent transmission ability of the file resource of monitor supervision platform.
Summary of the invention
In view of this, the invention solves a technical problem be to provide the method and system of data transmission a kind of.
A kind of method of data transmission, comprising: server-side receives the request for establishing TCP connection of client transmission, with Client establishes TCP connection;After TCP connection foundation, the client uploads files to institute by the TCP connection State server-side;Wherein, a TCP connection is created when transmitting single file;Multiple TCP are created when transmitting multiple files to connect It connects, the multiple file cocurrent transmission.
According to one embodiment of present invention, further, pass through the TCP between the server-side and the client Connecting the message interacted is interface protocol message, and the interface protocol message includes: message header and message body;Wherein, institute Stating message header, type of message and mark send information for identification.
According to one embodiment of present invention, further, the message header includes: packet length field, type field, sequence Number field;Wherein, the packet length field is used to identify the length of interface protocol message, and unit is byte;The type field For identifying the type of interface protocol message;The sequence number field can make interface protocol message have unique mark.
According to one embodiment of present invention, further, the value range of the type field is 0 to 7;Wherein, when When the value of the type field is 0, the type of interface protocol message is logging request;When the value of the type field is 1, connect The type of mouth protocol message is login response;When the value of the type field is 2, the type of interface protocol message is heartbeat Packet;When the value of the type field is 3, the type of interface protocol message is heartbeat packet response;When the value of the type field When being 4, the type of interface protocol message is that PU uploads file request;When the value of the type field is 5, interface protocol message Type be that the upper transmitting file of PU responds;When the value of the type field is 6, the type of interface protocol message is transmitting file on CU Request;When the value of the type field is 7, the type of interface protocol message is transmitting file response on CU.
According to one embodiment of present invention, further, after TCP connection foundation, the client passes through It includes: after TCP connection foundation that the TCP connection, which uploads files to the server-side, and the client is to the clothes Business end sends login request message;The server-side receives the login request message, to the visitor after being proved to be successful to it Family end sends login response message;After the client receives the login response message, sends and upload to the server-side File request message;The server-side receives the upload file request message, sends out after being proved to be successful to it to the client Serve transmitting file response message.
According to one embodiment of present invention, further, the message body of the login request message includes: number word Section, authenticator field;Wherein, the number field is for identifying client number;The authenticator field is for identifying client The legitimacy at end;The message body of the login response message includes: response code field, server version field;Wherein, the sound Code field is answered to return the result for identification request;The maximum version number that the server version field identification server-side is supported.
According to one embodiment of present invention, further, the server-side verifying login request message is illegal, Then directly close the TCP connection;Wherein, the interval time of establishing of TCP connection need to be greater than preset time interval twice in succession.
According to one embodiment of present invention, further, the upload file request message include: on PU transmitting file ask Message, CU is asked to upload file request message;Wherein, the message body for uploading file request message includes: version field, equipment Number field, channel number field, file type field, file sub-type field, alarm source description field, alarm time field, File digital section, end of file tag field, filename field, file format field, file store path field, document creation Time field, file size field.
According to one embodiment of present invention, further, the version field is for identifying version number;The equipment is compiled Number field includes: headend equipment number or client number for identifying document source, value;The channel number field is used for Identify document source;The file association channel number is used to identify the monitoring point channel number that picture and video recording are captured in alarm;It is described The value of file type field indicates picture when being 0, value indicates video when being 1;The value of the file sub-type field is 0 When indicate alarm capture picture, value be 1 when indicate capture face picture;The file digital section is same for identifying ownership The total number of files of alarm;The end of file tag field is used for the last one file for identifying whether to generate for current alarm.
According to one embodiment of present invention, further, the upper transmitting file response message includes: transmitting file sound on PU Answer the upper transmitting file response message of message, CU;Wherein, the message body of the upper transmitting file response message includes: responsive state code word Section;The responsive state code field, which is used to identify, uploads returning the result for file request.
According to one embodiment of present invention, further, upper transmitting file is sent to the server in the client After request message and before the upper transmitting file response message that the client receives that the server-side is sent, the client It holds and starts to send file data to the server-side.
According to one embodiment of present invention, further, the TCP connection includes: TCP long connection, the short connection of TCP; The TCP is short to be connected as establishing TCP connection when there is data interaction, this TCP connection is then disconnected after data have been sent;It is described TCP long connection refers to can repeatedly be interacted after TCP connection foundation with the client, during this TCP connection is kept, Heartbeat packet is sent from the client to the server-side to maintain this TCP connection.
According to one embodiment of present invention, further, the client with it is preset when a length of gap periods Ground sends heartbeat packet to the server-side, to maintain the TCP long connection;When server-side does not have in preset time threshold When receiving heartbeat packet, then the TCP long connection is disconnected.
According to one embodiment of present invention, further, the heartbeat packet only includes message header and does not include message body, The value of type field in message header is 2;The heartbeat packet response message only includes message header and does not include message body, message header In type field value be 3.
According to one embodiment of present invention, further, the client includes: device front end PU and video monitoring visitor Family end CU;The server-side includes: document management server.
A kind of system of data transmission, comprising: client and server-side;The server-side receives building for client transmission The request of vertical TCP connection, establishes TCP connection with the client;After TCP connection foundation, the client passes through The TCP connection uploads files to the server-side;Wherein, a TCP connection is created when transmitting single file;It is more when transmitting Multiple TCP connections, the multiple file cocurrent transmission are created when a file.
According to one embodiment of present invention, further, pass through the TCP between the server-side and the client Connecting the message interacted is interface protocol message, and the interface protocol message includes: message header and message body;Wherein, institute Stating message header, type of message and mark send information for identification.
According to one embodiment of present invention, further, the message header includes: packet length field, type field, sequence Number field;Wherein, the packet length field is used to identify the length of interface protocol message, and unit is byte;The type field For identifying the type of interface protocol message;The sequence number field can make interface protocol message have unique mark.
According to one embodiment of present invention, further, the value range of the type field is 0 to 7;Wherein, when When the value of the type field is 0, the type of interface protocol message is logging request;When the value of the type field is 1, connect The type of mouth protocol message is login response;When the value of the type field is 2, the type of interface protocol message is heartbeat Packet;When the value of the type field is 3, the type of interface protocol message is heartbeat packet response;When the value of the type field When being 4, the type of interface protocol message is that PU uploads file request;When the value of the type field is 5, interface protocol message Type be that the upper transmitting file of PU responds;When the value of the type field is 6, the type of interface protocol message is transmitting file on CU Request;When the value of the type field is 7, the type of interface protocol message is transmitting file response on CU.
According to one embodiment of present invention, further, after TCP connection foundation, the client is to institute It states server-side and sends login request message;The server-side receives the login request message, to institute after being proved to be successful to it It states client and sends login response message;After the client receives the login response message, sent to the server-side Upload file request message;The server-side receives the upload file request message, to the client after being proved to be successful to it End sends upper transmitting file response message.
According to one embodiment of present invention, further, the message body of the login request message includes: number word Section, authenticator field;Wherein, the number field is for identifying client number;The authenticator field is for identifying client The legitimacy at end;The message body of the login response message includes: response code field, server version field;Wherein, the sound Code field is answered to return the result for identification request;The maximum version number that the server version field identification server-side is supported.
According to one embodiment of present invention, further, the server-side verifying login request message is illegal, Then directly close the TCP connection;Wherein, the interval time of establishing of TCP connection need to be greater than preset time interval twice in succession.
According to one embodiment of present invention, further, the upload file request message include: on PU transmitting file ask Message, CU is asked to upload file request message;Wherein, the message body for uploading file request message includes: version field, equipment Number field, channel number field, file type field, file sub-type field, alarm source description field, alarm time field, File digital section, end of file tag field, filename field, file format field, file store path field, document creation Time field, file size field.
According to one embodiment of present invention, further, the version field is for identifying version number;The equipment is compiled Number field includes: headend equipment number or client number for identifying document source, value;The channel number field is used for Identify document source;The file association channel number is used to identify the monitoring point channel number that picture and video recording are captured in alarm;It is described The value of file type field indicates picture when being 0, value indicates video when being 1;The value of the file sub-type field is 0 When indicate alarm capture picture, value be 1 when indicate capture face picture;The file digital section is same for identifying ownership The total number of files of alarm;The end of file tag field is used for the last one file for identifying whether to generate for current alarm.
According to one embodiment of present invention, further, the upper transmitting file response message includes: transmitting file sound on PU Answer the upper transmitting file response message of message, CU;Wherein, the message body of the upper transmitting file response message includes: responsive state code word Section;The responsive state code field, which is used to identify, uploads returning the result for file request.
According to one embodiment of present invention, further, upper transmitting file is sent to the server in the client After request message and before the upper transmitting file response message that the client receives that the server-side is sent, the client It holds and starts to send file data to the server-side.
According to one embodiment of present invention, further, the TCP connection includes: TCP long connection, the short connection of TCP; The TCP is short to be connected as establishing TCP connection when there is data interaction, this TCP connection is then disconnected after data have been sent;It is described TCP long connection refers to can repeatedly be interacted after TCP connection foundation with the client, during this TCP connection is kept, Heartbeat packet is sent from the client to the server-side to maintain this TCP connection.
According to one embodiment of present invention, further, the client with it is preset when a length of gap periods Ground sends heartbeat packet to the server-side, to maintain the TCP long connection;When server-side does not have in preset time threshold When receiving heartbeat packet, then the TCP long connection is disconnected.
According to one embodiment of present invention, further, the heartbeat packet only includes message header and does not include message body, The value of type field in message header is 2;The heartbeat packet response message only includes message header and does not include message body, message header In type field value be 3.
According to one embodiment of present invention, further, the client includes: device front end PU and video monitoring visitor Family end CU;The server-side includes: document management server.
The method and system of data transmission of the invention can be supported to create multiple TCP connections when transmitting multiple files Concurrent transmission provides File Transfer Protocol, can be used as file coffret, and supports two kinds of connections of long connection and short connection Mode, can high efficiency of transmission file, effectively improve efficiency of transmission, reduce resources occupation rate.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only Some embodiments of the present invention, for those of ordinary skill in the art, without any creative labor, also Other attached drawings can be obtained according to these attached drawings.
Fig. 1 is the flow diagram of one embodiment of the method for data according to the present invention transmission;
Fig. 2 is the flow diagram of another embodiment of the method for data according to the present invention transmission;
Fig. 3 is that the message of TCP long connection in one embodiment of the method for data according to the present invention transmission sends signal Figure;
Fig. 4 is that the message of the short connection of TCP in one embodiment of the method for data according to the present invention transmission sends signal Figure;
Fig. 5 is the schematic diagram of one embodiment of the system of data according to the present invention transmission.
Specific embodiment
With reference to the accompanying drawings to invention is more fully described, wherein illustrating exemplary embodiment of the present invention.Under Face will combine the attached drawing in the embodiment of the present invention, and technical scheme in the embodiment of the invention is clearly and completely described, show So, described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on the reality in the present invention Example is applied, all other embodiment obtained by those of ordinary skill in the art without making creative efforts all belongs to In the scope of protection of the invention.Various descriptions are carried out to technical solution of the present invention below with reference to each figure and embodiment.
Fig. 1 is the flow diagram of one embodiment of the method for data according to the present invention transmission, as shown in Figure 1:
Step 101, server-side receives the request for establishing TCP connection of client transmission, establishes TCP with client and connects It connects.A TCP connection is created when transmitting single file, and multiple TCP connections, multiple file energy are created when transmitting multiple files Enough concurrent transmissions, can establish a TCP connection to each file, can also be with one TCP connection of multiple file-sharings.
Step 102, after TCP connection foundation, client uploads files to server-side by TCP connection.File can be with It is video file, image, text etc..Client includes PU (Prefocus Unit, headend equipment), video monitor client CU Deng.CU (Client Unit, client unit) is the general name that client control is applied in video monitoring system, is remote image The application platform of Centralized Monitoring and maintenance management, realize client monitored to the certification of center service, more pictures, alarm monitoring and The functions such as the remote maintenance of monitoring device permission.Server-side includes: FMS (file manage server, file-management services Device) etc..
The method of data transmission in above-described embodiment, can be based on video monitoring system high efficiency of transmission file, and transmission is single One TCP connection of creation is only needed when a file, and when transmitting multiple files, it supports to create multiple TCP connection concurrent transmissions, energy The efficiency of transmission of the file resource of monitor supervision platform is enough effectively improved, resources occupation rate is reduced.
The message interacted between server-side and client by TCP connection is interface protocol message, this interface protocol It can be used as front end for carrying out the agreement of upper transmitting file negotiation, control between server-side and client for File Transfer Protocol and set The file coffret of standby (PU), video monitor client and document management server (FMS), using Transmission Control Protocol, file management Server solves FTP bring performance issue as TCP server-side.
Interface protocol message format includes: message header (Header) and message body (Body), and message header therein refers to institute There are the common headers of message, for identifying type of message and caller information etc., each data packet must include message header, and disappear Breath body refers to specific message content, according to different messages type, defines different.
Message header includes: packet length field, type field, sequence number field etc..Packet length field is for identifying interface protocol The length of message, the length including message header and message body, unit is byte.Type field is for identifying interface protocol message Type.Sequence number field can make interface protocol message have unique mark, can be unique sequence number.Class in message header Type-word section is defined as follows shown in table 1:
The definition table of type field in table 1- message header
Login request message is logged in FMS for client, if after failure, needing to disconnect and logging in again, even The continuous interval time connected twice must be over 5 seconds.The message includes message header and message body, and it is 0 that message header, which sets type field, Its message body is defined as follows:
Number field (ClientID), if PU log in, then be PU number, if CU (video monitor client), then for Client number.Authenticator field (AuthCode), for the legitimacy of authentication equipment, in order to guarantee that uploading device is effectively to set Standby, equipment must be registered to video monitoring platform, return to Shared secret, authentication code calculation method: AuthCode by platform =MD5 (18 ClientID+Shared secret+TimeStamp), TimeStamp is timestamp, and content is by following field Definition, authentication code English character should be capitalized, and length is fixed as 32 bytes.Timestamp field (TimeStamp), content format= MMDDHHMMSS。
If type of message is 1, for login response message, the message body of login response message is defined as: response code field (Status), request returns the result.Server version (ServerVersion), the maximum version number that server is supported.If message Type is 2 or 3, no message body.
It uploads file request message to be sent from client to FMS, each file is uploaded to FMS preservation, all needs first to establish one A TCP connection first sends logging request after connection is successfully established, and after logining successfully, sends file upload request, file transmission After, it disconnects.Allow single client and FMS to establish multiple TCP connections simultaneously and carry out file transmission, to improve The concurrency of file transmission, shortens file transmission time, reduces the possibility to malfunction in document transmission process.
Uploading file request message includes message header and message body, if headend equipment demand file is transmitted, then message header Setting message type field is 4, if video monitor client demand file is transmitted, then it is 6 that message header, which sets message type field,.
If type of message is 4 or 6, the message body for uploading file request message is defined as follows: version field (Version), version number;Device numbering field (PUID), document source: headend equipment number or client number;Channel Number field (ChannelID), document source: the monitoring point channel number that file association channel number, i.e. alarm capture picture and video recording; File type field (FileType), 0 indicates picture, and 1 indicates video;File sub-type field (FileSubType), 0 indicates Picture is captured in alarm, and 1 indicates to capture face picture;Alarm source description field (AlarmSrc), identify channel type, channel number and Warning code;Alarm time field (AlarmTime), content format=yyyyMMddHHmmss;File digital section (FileTotalNum), belong to the total number of files of the same alarm;End of file tag field (TailFlag), indicate whether for The last one file that current alarm generates;Filename field (FileName) indicates the file name of transmission;File format word Section (FileFmt) indicates file format, such as bmp, jpeg;File store path field (FilePath) if it is empty then uses FMS Distribution;File creation time field (CreateTime), content format=yyyyMMddHHmmss;File size field (FileSize), file size is indicated.
If type of message is 5 or 7, then it represents that be upper transmitting file response message, the message body of upper transmitting file response message Be defined as follows: responsive state code (Status) indicates returning the result for file transmission request, for example, 1 being successfully, 2 being failure Deng.
Fig. 2 is the flow diagram of another embodiment of the method for data according to the present invention transmission, as shown in Figure 2: PU generates alarm, alarm picture need to be uploaded to FMS and saved, PU uses the communication mode of short connection.
Step 201, PU utilize socket and Transmission Control Protocol, establish connection with target FMS server, if PU produce it is multiple Picture is alerted, should establish multiple TCP connections at this time, while to FMS transmitting warning picture.
Step 202, for guarantee PU be it is legal, PU must video monitoring platform register, give file pipe in client Before managing server transmission alarm picture, it is necessary to send login request message to document management server.
Step 203, FMS receives login request message, parses login request message format, including verification message length, Type of message calculates simultaneously authentication verification code, to ensure message legitimacy, and logging request response message is replied to PU, if logging in It is illegal, directly close TCP connection.
Step 204, after PU is logined successfully, file transmission request can be sent to FMS.
Step 205, FMS receives client and uploads file request message, parses the message format first, verification message is long Degree, type of message and other fields whether legitimacy, and reply file transmission response message to PU, if message is illegal, direct pass Close TCP connection.
Step 206, it is the efficiency for improving file transmission, starts to send alarm figure after PU has sent file transmission request Piece, then receive the ACK confirmation message of FMS return.
Step 207,208, FMS start to receive file data, and save the data on disk, and FMS can be on thread Data receiver and data preservation are separated, to improve network I/O efficiency.
Step 209, after question paper is transmitted, PU closes TCP connection, so far completes a file transmission.
TCP connection includes: TCP long connection, the short connection of TCP.Long connection refer to after a TCP connection is established can continuously into Repeatedly interaction is needed by headend equipment every T1 seconds transmission heartbeat packets during connection is kept to maintain to connect row.When FMS is in T2 It is then disconnected when not receiving heartbeat packet in time second.For example, T1=15s, T2=3T1.
Short connection is that client establishes a TCP connection when there is data interaction, and data then disconnect after having sent, often Secondary interaction all re-establishes connection.Heartbeat packet only includes message header and does not include message body, the value of the type field in message header It is 2.Heartbeat packet response message only includes message header and does not include message body, and the value of the type field in message header is 3.
Fig. 3 is that the message of TCP long connection in one embodiment of the method for data according to the present invention transmission sends signal Figure, as shown in Figure 3:
Step 301, PU initiates TCP connection to FMS.
Step 302,302, after TCP connection foundation, PU sends message to FSM by TCP connection.
Step 303,304,305, PU with it is preset when a length of gap periods ground send heartbeat packet to FSM, such as in advance If when it is 10 seconds a length of, to maintain TCP long connection.When server-side does not receive heartbeat packet in preset time threshold, Then disconnect TCP long connection.
Step 306, PU sends message to FSM by TCP connection.
Step 307, PU initiates TCP turn-off request to FMS.
Fig. 4 is that the message of the short connection of TCP in one embodiment of the method for data according to the present invention transmission sends signal Figure, as shown in Figure 4:
Step 401, PU initiates TCP connection to FMS.
Step 402, after TCP connection foundation, PU sends message to FSM by TCP connection.
Step 403, after the end of transmission, PU initiates TCP turn-off request to FMS.
Step 404,405,406 repeat above-mentioned step.
The present invention provides a kind of system of data transmission, including multiple client 51,52,53 and server-side 55.Client 51,52,53 include: device front end PU and video monitor client CU etc.;Server-side 55 includes: document management server etc..With For client 51, server-side 55 receives the request for establishing TCP connection of the transmission of client 51, establishes TCP with client 51 Connection.After TCP connection foundation, client 51 uploads files to server-side 55 by TCP connection.When transmitting single file A TCP connection is created, multiple TCP connections, multiple file cocurrent transmission are created when transmitting multiple files.
The message interacted between server-side 55 and client 51 by TCP connection is interface protocol message, interface association Discussing message includes: message header and message body;Type of message and mark send information to message header for identification.Message header includes: Length field, type field, sequence number field etc..Packet length field is used to identify the length of interface protocol message, and unit is byte; Type field is used to identify the type of interface protocol message;Sequence number field can make interface protocol message have unique mark. The value range of type field is 0 to 7.
After TCP connection foundation, client 51 sends login request message to server-side 55.Server-side 55, which receives, steps on Request message is recorded, sends login response message to client 51 after being proved to be successful to it.Client 51 receives login response and disappears After breath, is sent to server-side 55 and upload file request message.Server-side 55, which receives, uploads file request message, is proved to be successful to it Upper transmitting file response message is sent to client 51 afterwards.
Server-side is received after client 51 sends upload file request message to server 55 and in client 51 Before the 55 upper transmitting file response messages sent, client 51 starts to send file data to server-side 55.TCP connection includes: TCP Long connection, the short connection of TCP.Client 51 with it is preset when a length of gap periods ground send heartbeat packet to server-side 55, use To maintain TCP long connection.When server-side 55 does not receive heartbeat packet in preset time threshold, then TCP long connection is disconnected.
The method and system of data transmission provided by the above embodiment can support creation more when transmitting multiple files A TCP connection concurrent transmission, provides File Transfer Protocol, can be used as file coffret, and supports long connection and short company Connect two kinds of connection types, can high efficiency of transmission file, effectively improve efficiency of transmission, reduce resources occupation rate.
Method and system of the invention may be achieved in many ways.For example, can by software, hardware, firmware or Software, hardware, firmware any combination realize method and system of the invention.The said sequence of the step of for method is only In order to be illustrated, the step of method of the invention, is not limited to sequence described in detail above, especially says unless otherwise It is bright.In addition, in some embodiments, also the present invention can be embodied as to record program in the recording medium, these programs include For realizing machine readable instructions according to the method for the present invention.Thus, the present invention also covers storage for executing according to this hair The recording medium of the program of bright method.
Description of the invention is given for the purpose of illustration and description, and is not exhaustively or will be of the invention It is limited to disclosed form.Many modifications and variations are obvious for the ordinary skill in the art.It selects and retouches It states embodiment and is to more preferably illustrate the principle of the present invention and practical application, and those skilled in the art is enable to manage The solution present invention is to design various embodiments suitable for specific applications with various modifications.

Claims (30)

1. a kind of method of data transmission characterized by comprising
Server-side receives the request for establishing TCP connection of client transmission, establishes TCP connection with the client;
After TCP connection foundation, the client uploads files to the server-side by the TCP connection;
Wherein, a TCP connection is created when transmitting single file;Multiple TCP connections are created when transmitting multiple files, it is described Multiple file cocurrent transmission;
The message interacted between the server-side and the client by the TCP connection is interface protocol message, institute Stating interface protocol message includes: message header, wherein the message header includes: the type field, is disappeared for identifying interface protocol The type of breath;The value range of the type field is 0 to 7;Wherein, when the value of the type field is 4, interface protocol disappears The type of breath is that PU uploads file request;When the value of the type field is 5, the type of interface protocol message is that PU uploads text Part response;When the value of the type field is 6, the type of interface protocol message is that CU uploads file request;When the type When the value of field is 7, the type of interface protocol message is transmitting file response on CU.
2. the method as described in claim 1, it is characterised in that:
The interface protocol message includes: message body.
3. method according to claim 2, it is characterised in that:
The message header includes: packet length field, sequence number field;
Wherein, the packet length field is used to identify the length of interface protocol message, and unit is byte;The sequence number field can Make interface protocol message that there is unique mark.
4. method as claimed in claim 3, it is characterised in that:
When the value of the type field is 0, the type of interface protocol message is logging request;When the value of the type field is When 1, the type of interface protocol message is login response;When the value of the type field is 2, the type of interface protocol message is Heartbeat packet;When the value of the type field is 3, the type of interface protocol message is heartbeat packet response.
5. method as claimed in claim 4, which is characterized in that the TCP connection foundation after, the client pass through institute It states TCP connection and uploads files to the server-side and include:
After TCP connection foundation, the client sends login request message to the server-side;
The server-side receives the login request message, sends login response to the client after being proved to be successful to it and disappears Breath;
After the client receives the login response message, is sent to the server-side and upload file request message;
The server-side receives the upload file request message, sends upper transmitting file to the client after being proved to be successful to it Response message.
6. method as claimed in claim 5, it is characterised in that:
The message body of the login request message includes: number field, authenticator field;
Wherein, the number field is for identifying client number;The authenticator field is used to identify the legitimacy of client;
The message body of the login response message includes: response code field, server version field;
Wherein, the response code field is returned the result for identification request;The server version field identification server-side is supported Maximum version number.
7. method as claimed in claim 5, it is characterised in that:
The server-side verifying login request message is illegal, then directly closes the TCP connection;
Wherein, the interval time of establishing of TCP connection need to be greater than preset time interval twice in succession.
8. method as claimed in claim 5, it is characterised in that:
The upload file request message includes: that PU uploads file request message, CU uploads file request message;
Wherein, the message body for uploading file request message includes: version field, device numbering field, channel number field, text Part type field, file sub-type field, alarm source description field, alarm time field, file digital section, end of file label Field, filename field, file format field, file store path field, file creation time field, file size field.
9. method according to claim 8, it is characterised in that:
The version field is for identifying version number;For the device numbering field for identifying document source, value includes: front end Device numbering or client number;The channel number field is for identifying document source;File association channel number is for identifying The monitoring point channel number of picture and video recording is captured in alarm;
The value of the file type field indicates picture when being 0, value indicates video when being 1;The file sub-type field Value be 0 when indicate alarm capture picture, value be 1 when indicate capture face picture;The file digital section is for identifying Belong to the total number of files of the same alarm;The end of file tag field is used to identify whether to generate for current alarm last One file.
10. method as claimed in claim 5, it is characterised in that:
The upper transmitting file response message includes: the upper transmitting file response message of transmitting file response message, CU on PU;
Wherein, the message body of the upper transmitting file response message includes: responsive state code field;The responsive state code field is used Returning the result for file request is uploaded in mark.
11. method as claimed in claim 5, it is characterised in that:
It is received after the client sends upload file request message to the server and in the client described Before the upper transmitting file response message that server-side is sent, the client starts to send file data to the server-side.
12. method as claimed in claim 4, it is characterised in that:
The TCP connection includes: TCP long connection, the short connection of TCP;
The TCP is short to be connected as establishing TCP connection when there is data interaction, this TCP connection is then disconnected after data have been sent;Institute State TCP long connection refer to TCP connection foundation after can repeatedly be interacted with the client, in this TCP connection retention period Between, heartbeat packet is sent from the client to the server-side to maintain this TCP connection.
13. method as claimed in claim 12, it is characterised in that:
The client with it is preset when a length of gap periods ground send heartbeat packet to the server-side, to remain described TCP long connection;
When server-side does not receive heartbeat packet in preset time threshold, then the TCP long connection is disconnected.
14. method as claimed in claim 12, it is characterised in that:
The heartbeat packet only includes message header and does not include message body, and the value of the type field in message header is 2;
The heartbeat packet response message only includes message header and does not include message body, and the value of the type field in message header is 3.
15. the method as described in claim 1 to 14 any one, it is characterised in that:
The client includes: device front end PU and video monitor client CU;
The server-side includes: document management server.
16. a kind of system of data transmission characterized by comprising
Client and server-side;
The server-side receives the request for establishing TCP connection of client transmission, establishes TCP connection with the client;? After the TCP connection is established, the client uploads files to the server-side by the TCP connection;Wherein, work as transmission A TCP connection is created when single file;Multiple TCP connections are created when transmitting multiple files, the multiple file cocurrent passes It is defeated;The message interacted between the server-side and the client by the TCP connection is interface protocol message, described Interface protocol message includes: message header;Wherein, the message header includes: type field, for identifying the class of interface protocol message Type;The value range of the type field is 0 to 7;
Wherein, when the value of the type field is 4, the type of interface protocol message is that PU uploads file request;When the class When the value of type-word section is 5, the type of interface protocol message is transmitting file response on PU;When the value of the type field is 6, connect The type of mouth protocol message is that CU uploads file request;When the value of the type field is 7, the type of interface protocol message is The upper transmitting file response of CU.
17. system as claimed in claim 16, it is characterised in that:
The interface protocol message includes: message body.
18. system as claimed in claim 17, it is characterised in that:
The message header includes: packet length field, sequence number field;
Wherein, the packet length field is used to identify the length of interface protocol message, and unit is byte;The sequence number field can Make interface protocol message that there is unique mark.
19. system as claimed in claim 18, it is characterised in that:
When the value of the type field is 0, the type of interface protocol message is logging request;When the value of the type field is When 1, the type of interface protocol message is login response;When the value of the type field is 2, the type of interface protocol message is Heartbeat packet;When the value of the type field is 3, the type of interface protocol message is heartbeat packet response.
20. system as claimed in claim 19, it is characterised in that:
After TCP connection foundation, the client sends login request message to the server-side;The service termination The login request message is received, sends login response message to the client after being proved to be successful to it;Client's termination After receiving the login response message, is sent to the server-side and upload file request message;The server-side receives on described Transmitting file request message sends upper transmitting file response message to the client after being proved to be successful to it.
21. system as claimed in claim 20, it is characterised in that:
The message body of the login request message includes: number field, authenticator field;Wherein, the number field is for marking Know client number;The authenticator field is used to identify the legitimacy of client;
The message body of the login response message includes: response code field, server version field;Wherein, the response code word Section is returned the result for identification request;The maximum version number that the server version field identification server-side is supported.
22. system as claimed in claim 20, it is characterised in that:
The server-side verifying login request message is illegal, then directly closes the TCP connection;Wherein, twice in succession The interval time of establishing of TCP connection need to be greater than preset time interval.
23. system as claimed in claim 20, it is characterised in that:
The upload file request message includes: that PU uploads file request message, CU uploads file request message;Wherein, described The message body for uploading file request message includes: version field, device numbering field, channel number field, file type field, text Part sub-type field, alarm source description field, alarm time field, file digital section, end of file tag field, file name Section, file format field, file store path field, file creation time field, file size field.
24. system as claimed in claim 23, it is characterised in that:
The version field is for identifying version number;For the device numbering field for identifying document source, value includes: front end Device numbering or client number;The channel number field is for identifying document source;File association channel number is for identifying The monitoring point channel number of picture and video recording is captured in alarm;The value of the file type field indicates picture, value 1 when being 0 When indicate video;It indicates that picture is captured in alarm when the value of the file sub-type field is 0, indicates to capture people when value is 1 Face picture;The file digital section is for identifying the total number of files for belonging to the same alarm;The end of file tag field is used In the last one file for identifying whether to generate for current alarm.
25. system as claimed in claim 20, it is characterised in that:
The upper transmitting file response message includes: the upper transmitting file response message of transmitting file response message, CU on PU;Wherein, described The message body of upper transmitting file response message includes: responsive state code field;The responsive state code field uploads text for identifying Part request returns the result.
26. system as claimed in claim 20, it is characterised in that:
It is received after the client sends upload file request message to the server and in the client described Before the upper transmitting file response message that server-side is sent, the client starts to send file data to the server-side.
27. system as claimed in claim 26, it is characterised in that:
The TCP connection includes: TCP long connection, the short connection of TCP;The TCP is short to be connected as establishing TCP when there is data interaction Connection, then disconnects this TCP connection after data have been sent;The TCP long connection refer to TCP connection foundation after can with it is described Client is repeatedly interacted, and during this TCP connection is kept, sends heartbeat packet from the client to the server-side to tie up Hold this TCP connection.
28. system as claimed in claim 27, it is characterised in that:
The client with it is preset when a length of gap periods ground send heartbeat packet to the server-side, to remain described TCP long connection;When server-side does not receive heartbeat packet in preset time threshold, then the TCP long connection is disconnected.
29. system as claimed in claim 27, it is characterised in that:
The heartbeat packet only includes message header and does not include message body, and the value of the type field in message header is 2;The heartbeat packet Response message only includes message header and does not include message body, and the value of the type field in message header is 3.
30. the system as described in claim 16 to 29 any one, it is characterised in that:
The client includes: device front end PU and video monitor client CU;The server-side includes: file-management services Device.
CN201511025486.5A 2015-12-31 2015-12-31 A kind of method and system of data transmission Active CN105610836B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511025486.5A CN105610836B (en) 2015-12-31 2015-12-31 A kind of method and system of data transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511025486.5A CN105610836B (en) 2015-12-31 2015-12-31 A kind of method and system of data transmission

Publications (2)

Publication Number Publication Date
CN105610836A CN105610836A (en) 2016-05-25
CN105610836B true CN105610836B (en) 2019-01-15

Family

ID=55990374

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511025486.5A Active CN105610836B (en) 2015-12-31 2015-12-31 A kind of method and system of data transmission

Country Status (1)

Country Link
CN (1) CN105610836B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106657135B (en) * 2017-01-12 2020-01-07 上海艾讯云计算有限公司 File transmission method and equipment based on secure socket layer protocol authentication
CN107133578B (en) * 2017-04-19 2020-05-22 华南理工大学 Facial expression recognition method and system based on file transmission
CN107222541B (en) * 2017-06-06 2020-10-16 南京南瑞继保电气有限公司 New energy power prediction file uploading method and system
CN109089358B (en) * 2018-08-20 2020-11-03 厦门久贤新能源科技有限公司 Communication control method and system based on Internet of things light energy street lamp
CN108809363A (en) * 2018-08-27 2018-11-13 优视科技新加坡有限公司 Near-field Data transmission method and its device
CN109274510B (en) * 2018-09-06 2022-01-21 北京达佳互联信息技术有限公司 Message processing method, device, client, server and storage medium
CN109547571A (en) * 2018-12-30 2019-03-29 北京敏视达雷达有限公司 A kind of base data transmission method and system
CN110113343A (en) * 2019-05-13 2019-08-09 福建中润电子科技有限公司 A kind of method and system obtaining data of set top box
CN110737655B (en) * 2019-10-21 2021-07-30 京东数字科技控股有限公司 Method and device for reporting data
CN111404959A (en) * 2020-03-26 2020-07-10 中车青岛四方车辆研究所有限公司 Method and system for realizing transmission of non-real-time offline file
CN111614752B (en) * 2020-05-19 2022-08-30 北京百度网讯科技有限公司 Method and device for data transmission
BE1029472B1 (en) * 2021-06-08 2023-01-16 Unmatched Bv METHOD FOR FOLLOWING AND HANDLING ALARMS IN AN ALERT SYSTEM AND AN ALERT SYSTEM
CN113595980B (en) * 2021-06-25 2023-05-23 杭州天宽科技有限公司 Configuration method based on TCP communication custom protocol
CN117579394B (en) * 2024-01-16 2024-04-09 麒麟软件有限公司 Secure transmission method based on TCP protocol under multi-client condition

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102710748B (en) * 2012-05-02 2016-01-27 华为技术有限公司 Data capture method, system and equipment

Also Published As

Publication number Publication date
CN105610836A (en) 2016-05-25

Similar Documents

Publication Publication Date Title
CN105610836B (en) A kind of method and system of data transmission
KR102167613B1 (en) Message push method and device
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
CN103152378B (en) A kind of transmission method of network data, system and client
CN101667928B (en) Client, signaling tracking server, protocol module and signaling tracking method
CN106534808B (en) A kind of video monitoring method and device based on virtual camera
CN102075338B (en) Distributed network-based live broadcasting method and device
US20190075149A1 (en) Mechanisms to support adaptive constrained application protocol (coap) streaming for internet of things (iot) systems
CN103401946B (en) HTTP uploads accelerated method and system
CN105825409B (en) Electronic invoice message pushing system and method
CN100556134C (en) Apparatus for unified monitoring multi-path remote video
CN110381119B (en) Method, system and device for acquiring log information and storage medium
CN109327493A (en) A kind of remote medical monitoring system based on cloud and monitoring method
CN108011698B (en) RSSP-I secure communication method based on dual-system synchronization
CN101127623A (en) Data processing method, device and system
CN106652115B (en) A kind of video Gate-ban Monitoring System based on server platform
CN110809026B (en) File processing method and device, electronic equipment and storage medium
CN113098985B (en) Session management method and scheduling server
CN109889454A (en) A kind of the message driving means and method of micro services framework
CN103312593B (en) A kind of message distributing system and method
CN108769805A (en) Data transmission method, device, computer equipment and storage medium
CN104506497A (en) Information issuing method and system
CN112995234A (en) Media transmission link management method and device
CN105207860A (en) Business acceleration system and method
CN112866390B (en) Data transmission method, device, terminal equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant