CN104780211B - Method of data synchronization and device - Google Patents
Method of data synchronization and device Download PDFInfo
- Publication number
- CN104780211B CN104780211B CN201510173247.8A CN201510173247A CN104780211B CN 104780211 B CN104780211 B CN 104780211B CN 201510173247 A CN201510173247 A CN 201510173247A CN 104780211 B CN104780211 B CN 104780211B
- Authority
- CN
- China
- Prior art keywords
- data
- client
- server
- synchronized
- synchronization
- 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
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
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/06—Network architectures or network communication protocols for network security for supporting key management in a packet data network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Transfer Between Computers (AREA)
- Computer And Data Communications (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses a kind of method of data synchronization and device, described method of data synchronization includes step: client obtains access credentials and message key from server, and described message key is for data mutual between encryption and decryption subsequent client and server;Client uses described access credentials to access server, to server for services device end data to be synchronized;The described server end data to be synchronized that client sends according to server carry out data synchronization processing;After process completes, client obtains client Data Concurrent to be synchronized and gives server, so that server carries out data synchronization processing, and the result that confirmed service device sends according to described client data to be synchronized.The performance of Appropriate application mobile terminal of the present invention, gives mobile terminal (client) and processes, substantially reduce the pressure of server, be effectively increased the concurrent processing quantity of server when carrying out data syn-chronization by the operation logic of data syn-chronization.
Description
Technical field
The present invention relates to communication technical field, especially relate to a kind of method of data synchronization and device.
Background technology
Along with the gradually maturation of 3G technology and popularizing of mobile terminal, the mobile Internet epoch are pulled open step by step
Curtain.People will use the mobile terminals such as smart mobile phone, panel computer, e-book to connect interconnection more
Net acquisition information.Different from the Internet era of PC, it is many that the mobile Internet epoch will present terminal, platform
The trend of sample.Diversified information channel is bringing user easily simultaneously, have also been introduced many equipment it
Between the difficult problem of data fusion.User is in the urgent need to a kind of technology so that the data between various equipment reach
Uniformity, therefore data synchronization technology arises at the historic moment.
At present, the logical process of data syn-chronization is all to carry out at server end, client send client
Data to be synchronized for server end, to server, are sent to client after server process is complete by data to be synchronized
End, server also needs to safeguard the mapping relations table of synchrodata client id and server end ID simultaneously.
But, along with the development of mobile terminal is with universal, the process request of client is more and more so that
The pressure of server is the most increasing.
Summary of the invention
Present invention is primarily targeted at a kind of method of data synchronization of offer and device, it is intended to data syn-chronization mistake
Journey reduces the pressure of server, is effectively improved the concurrent processing quantity of server.
To achieve these objectives, the present invention proposes a kind of method of data synchronization, is applied to client, including step
Rapid:
Client obtains access credentials and message key from server, and described message key is after encryption and decryption
Data mutual between continuous client and server;
Client uses described access credentials to access server, to server for services device end number to be synchronized
According to;
The described server end data to be synchronized that client sends according to server carry out data synchronization processing;
After process completes, client obtains client Data Concurrent to be synchronized and gives server, so that service
Device carries out data synchronization processing, and the process that confirmed service device sends according to described client data to be synchronized
Result.
Preferably, described client acquisition client data to be synchronized include: client is by every pen data
Last modification time stamp and the last timestamp synchronized compare, and obtain last simultaneously operating complete
The data of Cheng Houyou amendment, and therefrom reject by described server end data synchronization updating to be synchronized mistake
Data after as client data to be synchronized.
Preferably, described access credentials by server address, user profile, client ip address or/and time
Between stamp composition.
The present invention also proposes a kind of method of data synchronization, is applied to server end, including step:
Server generates access credentials and message key and is sent to client, and described message key is used for adding
Data mutual between deciphering subsequent client and server;
The access credentials that client is provided by server verifies;
When verification by after, server obtain server end Data Concurrent to be synchronized give client so that
Client carries out data synchronization processing according to described server end data to be synchronized;
Server receives the client data to be synchronized that client sends, according to described client number to be synchronized
According to carrying out data synchronization processing, and result is returned to client.
Preferably, described server acquisition server end data to be synchronized include: server is by every pen data
Last modification time stamp and the last timestamp synchronized compare, obtain last simultaneously operating
The data of amendment are had as server end data to be synchronized after completing.
Preferably, described method also includes: after terminating alternately every time, and server update message key returns
To client, for next time mutual time use.
The present invention proposes a kind of data synchronization unit simultaneously, is applied to client, including acquisition module, the
One synchronization module and the second synchronization module, wherein:
Described acquisition module, for obtaining access credentials and message key, described message key from server
For data mutual between encryption and decryption subsequent client and server;
Described first synchronization module, is used for using described access credentials to access server, to server request
Server end data to be synchronized, carry out data according to the described server end data to be synchronized that server sends
Synchronization process;
Described second synchronization module, for after the first synchronization module has processed, obtains client and treats same
Step data is also sent to server, so that server carries out data together according to described client data to be synchronized
Step processes, and the result that confirmed service device sends.
Preferably, described second synchronization module is used for:
The last modification time of every pen data is stabbed and the last timestamp synchronized compares, obtain
Last simultaneously operating has data of amendment after completing, and therefrom reject by described server end treat with
As client data to be synchronized after the data that step data synchronized update is crossed.
The present invention also proposes a kind of data synchronization unit, is applied to server end, including signal generating unit, school
Verification certificate unit, the first lock unit and the second lock unit, wherein:
Described signal generating unit, is used for generating access credentials and message key and being sent to client, described in disappear
Breath key is for data mutual between encryption and decryption subsequent client and server;
Described verification unit, verifies for the access credentials providing client;
Described first lock unit, for when verification by after, acquisition server end Data Concurrent to be synchronized
Give client, so that client carries out data synchronization processing according to described server end data to be synchronized;
Described second lock unit, for receiving the client data to be synchronized that client sends, according to institute
State client data to be synchronized and carry out data synchronization processing, and result is returned to client.
Preferably, described first lock unit is used for: stabbed by the last modification time of every pen data and nearest
One hyposynchronous timestamp compares, and obtains the data conduct having amendment after last simultaneously operating completes
Server end data to be synchronized.
Preferably, described signal generating unit is additionally operable to: after terminating alternately every time, updates message key and returns to
Client, for next time mutual time use.
Preferably, described signal generating unit is used for: according to server address, user profile, client ip ground
Location is or/and timestamp generates access credentials.
A kind of method of data synchronization provided by the present invention and device, the performance of Appropriate application mobile terminal,
The operation logic of data syn-chronization is given mobile terminal (client) when carrying out data syn-chronization process,
Substantially reduce the pressure of server, be effectively increased the concurrent processing quantity of server.Meanwhile, service
Device end need not safeguard the mapping relations table of synchrodata client Id and server end ID, simplifies synchronization
Operating process.And, the present invention uses access credentials verification and the mode of message key encryption exchange data,
Improve authentication mode mutual between server and client side, decrease server and client side mutual
Number of times, optimizes the browsing process of client and server, is effectively increased the efficiency of whole simultaneously operating.
Accompanying drawing explanation
Fig. 1 is the flow chart of the method for data synchronization first embodiment of the present invention;
Fig. 2 is the module diagram of the data synchronization unit first embodiment of the present invention;
Fig. 3 is the flow chart of method of data synchronization second embodiment of the present invention;
Fig. 4 is the module diagram of data synchronization unit second embodiment of the present invention;
Fig. 5 is the module diagram of data synchronous system one embodiment of the present invention.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, do referring to the drawings further
Explanation.
Detailed description of the invention
Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not used to limit
Determine the present invention.
In view of the performance of mobile terminal improves constantly, the performance of Appropriate application mobile terminal of the present invention, entering
The operation logic of data syn-chronization is given during row data syn-chronization mobile terminal process, to substantially reduce service
The pressure of device, is effectively improved the concurrent processing quantity of server.Below by way of specific embodiment to the present invention
Technical scheme be described in detail.
Embodiment one
See Fig. 1, propose method of data synchronization one embodiment of the present invention, the data syn-chronization side of the present embodiment
Method is applied to client, comprises the following steps:
Step S11: client obtains access credentials and message key from server.
Concrete, (password value can be clear-text passwords and other ginseng for the account of client use user and password
Number carries out the value after md5 encryption together) etc. user profile access server (such as FOTA server), clothes
The user profile such as account number and password is verified by business device, by then generating server access voucher after checking
(Token Id) and message key, and it is sent to client.Client in the present invention, refers to and services
Device carries out the terminal device of data syn-chronization, such as mobile terminals such as mobile phone, panel computer, e-book.
Wherein, message key is used for data mutual between subsequent client and server are carried out encryption and decryption,
I.e. all data of subsequent client and server interaction are entered after being required to be encrypted by message key again
Row transmits.Access credentials by server address, user profile, client ip address or/and timestamp forms,
I.e. server is according to arbitrary in FOTA server address, user profile, client ip address and timestamp
Plant or any combination generates access credentials.
Step S12: client uses access credentials to access server, treats same to server for services device end
Step data.
Concrete, client uses access credentials to access server, treats same to server for services device end
Step data.The access credentials that client is provided by server verifies, and verification, by rear, obtains service
Device end data to be synchronized, and use message key data to be synchronized to server end to be sent to after being encrypted
Client.
The structure of the server end data to be synchronized that server sends is: sid+status (N/U/D)+
dataInfo.Wherein, the server ID that sid mark synchrodata is corresponding, is that server data uniquely identifies;
The action type of status (N/U/D) mark synchrodata, wherein N represents newly-increased, and U represents amendment, D
Represent and delete;The detail of dataInfo mark synchrodata.
Server can obtain server end data to be synchronized in the following manner: server is every by storage
The last modification time stamp of pen data compares with the last timestamp synchronized, and obtains last same
Step has the data of amendment as server end data to be synchronized after having operated.Such as, if certain pen data
Rear modification time stamp is later than the timestamp of the last synchronization, then it is assumed that this pen data once synchronizes behaviour upper
There is amendment after completing, otherwise then think and do not revise.
Step S13: the server end data to be synchronized that client sends according to server are carried out at data syn-chronization
Reason.
Concrete, after client receives server end data to be synchronized, according to server end number to be synchronized
According to structure sid+status (N/U/D)+dataInfo in sid inquiring client terminal local data.Work as client
When end local data has existed data corresponding for this sid, then directly carry out according to status (N/U/D)
Data modification.
When client local data does not exist data corresponding for this sid, then by number to be synchronized for server end
Update to database according to after comparing process with other without the data of sid.For example:
Assume that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, by A and client
In end, other compares without the datainfo of the data of sid.If client has identical datainfo (concrete
Determination methods can be arranged according to demand) data B:cid+status (N/U/D)+datainfo, wherein cid mark
Know the client id that synchrodata is corresponding, be that client data uniquely identifies, then the sid of A updated
In B, End-Customer end obtains data B:cid+sid+status (N/U/D)+dataInfo;If client
There is no the data of identical datainfo, then directly A is increased newly in the local data base of client, client
End also obtains data B:cid+sid+status (N/U/D)+dataInfo.
Step S14: client obtains client Data Concurrent to be synchronized and gives server, so that server root
Data synchronization processing, and the result that confirmed service device sends is carried out according to client data to be synchronized.
Concrete, after the complete server end of client process data to be synchronized, obtain client data to be synchronized,
And use message key to be sent to server after being encrypted.The structure of client data to be synchronized has two kinds,
One is: sid+cid+status (N/U/D)+dataInfo, and another kind is: cid+status (N)+
DataInfo (when client does not has the data of sid, status is disposed as newly-increased N).
Client can obtain client data to be synchronized in the following manner: client is by every pen data
Last modification time stamp and the last timestamp synchronized compare, and obtain last simultaneously operating complete
Cheng Houyou amendment data, and therefrom reject in previous step S13 by server end number to be synchronized
According to after the data that synchronized update is crossed as client data to be synchronized.
After server receives client data to be synchronized, carry out data according to client data to be synchronized same
Step processes, and result is returned to client.If it is last that client has mark currently transmitted
One packet, server nullifies access credentials and the message key of this operation the most simultaneously.
When server carries out synchronization process, it is sid+cid+status (N/U/D)+dataInfo for structure
Data, then directly update according to sid in the database of server;It is cid+status (N) for structure
The data of+dataInfo, the most directly increase newly in the database of server, and obtain by the newly-increased number of this part
According to the mapping relations one to one of sid Yu cid composition, and by the return of the mapping relations of sid Yu cid
To client.Sid, according to the mapping relations of sid and cid received, is updated by client by cid
In corresponding synchrodata, final data simultaneously operating completes.Final result is:
Server synchronizes with client data to keep consistent;
All data structures of client are: sid+cid+status (N/U/D)+dataInfo;
All data structures of server are: sid+status (N/U/D)+dataInfo.
Further, after terminating the most alternately, server all can update message key and return to client,
For next time mutual time use, i.e. server and client are often mutual the most just refreshes a message key,
Thus improve the security of data interaction.
See Fig. 2, propose the present invention and realize data synchronization unit one embodiment of above-mentioned method of data synchronization,
The data synchronization unit of the present embodiment is applied to client, including acquisition module, the first synchronization module and
Two synchronization modules, wherein:
Acquisition module: for obtaining access credentials and message key from server.
Concrete, acquisition module use the account of user and password (password value can be clear-text passwords and other
Parameter carries out the value after md5 encryption together) etc. user profile access server, receive server send
Access credentials (Token Id) and message key.
Wherein, message key is used for information mutual between subsequent client and server is carried out encryption and decryption,
I.e. all information of subsequent client and server interaction are entered after being required to be encrypted by message key again
Row transmits.Access credentials by server address, user profile, client ip address or/and timestamp forms.
First synchronization module: be used for using access credentials to access server, to server for services device end
Data to be synchronized, carry out data synchronization processing according to the server end data to be synchronized that server sends.
Concrete, the first synchronization module uses access credentials to access server, to server for services device
Hold data to be synchronized.After first synchronization module receives server end data to be synchronized, it is resolved,
Sid inquiry visitor in structure sid+status (N/U/D)+dataInfo according to server end data to be synchronized
Family end local data.When having there are data corresponding for this sid in client local data, first synchronizes
Module then directly carries out data modification according to status (N/U/D).
When there are not data corresponding for this sid in client local data, the first synchronization module then will service
Device end data to be synchronized update after comparing process with other without the data of sid and arrive database.Citing and
Speech:
Assuming that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, first synchronizes mould
Block is by A and client, other compares without the datainfo of the data of sid.If client has identical
Data B:cid+status (N/U/D) of datainfo (concrete determination methods can be arranged according to demand)+
Datainfo, the sid of A is then updated in B, finally gives data B:cid+sid+ by the first synchronization module
status(N/U/D)+dataInfo;If client does not has the data of identical datainfo, the first synchronization module
Then directly A is increased newly in the local data base of client, finally give data B:cid+sid+
status(N/U/D)+dataInfo。
Second synchronization module: be used for obtaining client Data Concurrent to be synchronized and give server, so that service
Device carries out data synchronization processing, and the result that confirmed service device sends according to client data to be synchronized.
Concrete, after the first synchronization module has processed server end data to be synchronized, the second synchronization module
Then obtain client data to be synchronized, and use message key to be sent to server after being encrypted.Client
The structure holding data to be synchronized has two kinds, Yi Zhongwei: sid+cid+status (N/U/D)+dataInfo, separately
One is: (when client does not has the data of sid, status is respectively provided with cid+status (N)+dataInfo
For newly-increased N).
Second synchronization module can obtain client data to be synchronized in the following manner: the second synchronization module
The last modification time of every pen data is stabbed and the last timestamp synchronized compares, obtain upper one
Subsynchronous operation has the data of amendment after completing, and therefrom rejects same by server end data to be synchronized
Walk remaining data after updated data, as client data to be synchronized.
After server carries out data synchronization processing according to client data to be synchronized, can reflecting sid with cid
The relation of penetrating returns to client.Second synchronization module is according to the mapping relations of sid and cid received, logical
Cross in the synchrodata that sid is updated correspondence by cid, be finally completed data syn-chronization operation.
Thus, the method for data synchronization of the present embodiment and device, the performance of Appropriate application mobile terminal,
The operation logic of data syn-chronization is given when carrying out data syn-chronization mobile terminal (client) process, greatly
Reduce greatly the pressure of server, be effectively increased the concurrent processing quantity of server.Meanwhile, server
End need not safeguard the mapping relations table of synchrodata client Id and server end ID, simplifies synchronization behaviour
Make flow process.And, the present invention uses access credentials verification and the mode of message key encryption exchange data,
Improve authentication mode mutual between server and client side, decrease server and client side mutual
Number of times, optimizes the browsing process of client and server, is effectively increased the efficiency of whole simultaneously operating.
Embodiment two
See Fig. 3, propose another embodiment of method of data synchronization of the present invention, the data syn-chronization of the present embodiment
Method is applied to server end, comprises the following steps:
Step S21: server generates access credentials and message key and is sent to client.
Concrete, (password value can be clear-text passwords and other ginseng for the account of client use user and password
Number carries out the value after md5 encryption together) etc. user profile access server (such as FOTA server), clothes
The user profile such as account number and password is verified by business device, by then generating server access voucher after checking
(Token Id) and message key, and it is sent to client.
Wherein, message key is used for data mutual between subsequent client and server are carried out encryption and decryption,
I.e. all data of subsequent client and server interaction are entered after being required to be encrypted by message key again
Row transmits.Access credentials by server address, user profile, client ip address or/and timestamp forms,
I.e. server is according to arbitrary in FOTA server address, user profile, client ip address and timestamp
Plant or any combination generates access credentials.
Step S22: the access credentials that client is provided by server verifies.
Concrete, client uses access credentials to access server, treats same to server for services device end
Step data.The access credentials that client is provided by server verifies, the legitimacy of authentication-access voucher.
Step S23: when verification by after, server obtain server end Data Concurrent to be synchronized give client
End, so that client carries out data synchronization processing according to server end data to be synchronized.
Concrete, verification is by rear, and server obtains server end data to be synchronized, and uses message close
Key data to be synchronized to server end are sent to client after being encrypted.
The structure of the server end data to be synchronized that server sends is: sid+status (N/U/D)+
dataInfo.Wherein, the server ID that sid mark synchrodata is corresponding, is that server data uniquely identifies;
The action type of status (N/U/D) mark synchrodata, wherein N represents newly-increased, and U represents amendment, D
Represent and delete;The detail of dataInfo mark synchrodata.
Server can obtain server end data to be synchronized in the following manner: server is every by storage
The last modification time stamp of pen data compares with the last timestamp synchronized, and obtains last same
Step has the data of amendment as server end data to be synchronized after having operated.Such as, if certain pen data
Rear modification time stamp is later than the timestamp of the last synchronization, then it is assumed that this pen data once synchronizes behaviour upper
There is amendment after completing, otherwise then think and do not revise.
After client receives server end data to be synchronized, according to the structure of server end data to be synchronized
Sid inquiring client terminal local data in sid+status (N/U/D)+dataInfo.When client this locality number
When there are data corresponding for this sid according to, then directly carry out data modification according to status (N/U/D).
When client local data does not exist data corresponding for this sid, then by number to be synchronized for server end
Update to database according to after comparing process with other without the data of sid.For example:
Assume that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, by A and client
In end, other compares without the datainfo of the data of sid.If client has identical datainfo (concrete
Determination methods can be arranged according to demand) data B:cid+status (N/U/D)+datainfo, wherein cid mark
Know the client id that synchrodata is corresponding, be that client data uniquely identifies, then the sid of A updated
In B, End-Customer end obtains data B:cid+sid+status (N/U/D)+dataInfo;If client
There is no the data of identical datainfo, then directly A is increased newly in the local data base of client, client
End also obtains data B:cid+sid+status (N/U/D)+dataInfo.
Step S24: server receives the client data to be synchronized that client sends, treats same according to client
Step data carries out data synchronization processing, and result is returned to client.
Concrete, after the complete server end of client process data to be synchronized, obtain client data to be synchronized,
And use message key to be sent to server after being encrypted.The structure of client data to be synchronized has two kinds,
One is: sid+cid+status (N/U/D)+dataInfo, and another kind is: cid+status (N)+
DataInfo (when client does not has the data of sid, status is disposed as newly-increased N).
Client can obtain client data to be synchronized in the following manner: client is by every pen data
Last modification time stamp and the last timestamp synchronized compare, and obtain last simultaneously operating complete
The data of Cheng Houyou amendment, and therefrom reject the number crossed by server end data synchronization updating to be synchronized
According to rear as client data to be synchronized.
After server receives client data to be synchronized, carry out data according to client data to be synchronized same
Step processes, and result is returned to client.If it is last that client has mark currently transmitted
One packet, server nullifies access credentials and the message key of this operation the most simultaneously.
When server carries out synchronization process, it is sid+cid+status (N/U/D)+dataInfo for structure
Data, then directly update according to sid in the database of server;It is cid+status (N) for structure
The data of+dataInfo, the most directly increase newly in the database of server, and obtain by the newly-increased number of this part
According to the mapping relations one to one of sid Yu cid composition, and by the return of the mapping relations of sid Yu cid
To client.Sid, according to the mapping relations of sid and cid received, is updated by client by cid
In corresponding synchrodata, final data simultaneously operating completes.Final result is:
Server synchronizes with client data to keep consistent;
All data structures of client are: sid+cid+status (N/U/D)+dataInfo;
All data structures of server are: sid+status (N/U/D)+dataInfo.
Further, after terminating the most alternately, server all can update message key and return to client,
For next time mutual time use, i.e. server and client are often mutual the most just refreshes a message key,
Thus improve the security of data interaction.
See Fig. 4, propose the present invention and realize another enforcement of data synchronization unit of above-mentioned method of data synchronization
Example, the data synchronization unit of the present embodiment is applied to server end, including signal generating unit, verification unit,
First lock unit and the second lock unit, wherein:
Signal generating unit: be used for generating access credentials and message key and being sent to client.
Concrete, (password value can be clear-text passwords and other ginseng for the account of client use user and password
Number carries out the value after md5 encryption together) etc. user profile access server, server is to account number and password
Verifying etc. user profile, after checking, signal generating unit then generates server access voucher (Token
And message key, and be sent to client Id).
Wherein, message key is used for information mutual between subsequent client and server is carried out encryption and decryption,
I.e. all information of subsequent client and server interaction are entered after being required to be encrypted by message key again
Row transmits.Access credentials by server address, user profile, client ip address or/and timestamp forms,
I.e. any one according in server address, user profile, client ip address and timestamp of signal generating unit
Plant or any combination generates access credentials.
Verification unit: the access credentials for providing client verifies.
Concrete, when client uses access credentials to access server, treat to server for services device end
During synchrodata, the access credentials that client is then provided by verification unit verifies, authentication-access voucher
Legitimacy.When verification by time, verification unit then to first lock unit send check results.
First lock unit: for when verification by after, acquisition server end Data Concurrent to be synchronized give
Client, so that client carries out data synchronization processing according to server end data to be synchronized.
Concrete, verification is by rear, and the first lock unit obtains server end data to be synchronized, and uses
Message key data to be synchronized to server end are sent to client after being encrypted.
The structure of the server end data to be synchronized that the first lock unit sends is: sid+status (N/U/D)+
dataInfo.First lock unit can obtain server end data to be synchronized in the following manner: first is same
Last modification time stamp and the last timestamp synchronized of every pen data of storage are compared by step unit
Relatively, the last simultaneously operating of acquisition has the data of amendment as server end data to be synchronized after completing.Example
As, if certain pen data last modification time stamp is later than the timestamp of the last synchronization, then it is assumed that this stroke count
There is amendment according to upper after once simultaneously operating completes, otherwise then think and do not revise.
Second lock unit: for receiving the client data to be synchronized that client sends, according to client
Data to be synchronized carry out data synchronization processing, and result is returned to client.
Concrete, after the complete server end of client process data to be synchronized, send two kinds of lattice to server end
The client data to be synchronized of formula, Yi Zhongwei: sid+cid+status (N/U/D)+dataInfo, another kind of
For: (when client does not has the data of sid, status is disposed as newly cid+status (N)+dataInfo
Increase N).After second lock unit receives client data to be synchronized, it is resolved, then basis
Client data to be synchronized carry out data synchronization processing, and result is returned to client.If it is objective
It is last packet that family end has mark currently transmitted, and the second lock unit nullifies this behaviour the most simultaneously
The access credentials made and message key.
When second lock unit carries out synchronization process, for structure be sid+cid+status (N/U/D)+
The data of dataInfo, then directly update according to sid in the database of server;It is cid+ for structure
The data of status (N)+dataInfo, the most directly increase newly in the database of server, and obtain by this portion
Divide the mapping relations one to one of sid Yu the cid composition of newly-increased data, and by the mapping of sid Yu cid
Relation returns to client.Client, will by cid according to the mapping relations of sid and cid received
Sid updates in the synchrodata of correspondence, and final data simultaneously operating completes.
Further, after terminating the most alternately, signal generating unit all can update message key and return to client,
For next time mutual time use, i.e. server and client are often mutual the most just refreshes a message key,
Thus improve the security of data interaction.
Thus, the method for data synchronization of the present embodiment and device, the performance of Appropriate application mobile terminal,
The operation logic of data syn-chronization is given when carrying out data syn-chronization mobile terminal (client) process, greatly
Reduce greatly the pressure of server, be effectively increased the concurrent processing quantity of server.Meanwhile, server
End need not safeguard the mapping relations table of synchrodata client Id and server end ID, simplifies synchronization behaviour
Make flow process.And, the present invention uses access credentials verification and the mode of message key encryption exchange data,
Improve authentication mode mutual between server and client side, decrease server and client side mutual
Number of times, optimizes the browsing process of client and server, is effectively increased the efficiency of whole simultaneously operating.
Embodiment three
Seeing Fig. 5, for data synchronous system one embodiment of the present invention, described data synchronous system includes visitor
Family end and server, described client and server is involved in previous embodiment one and embodiment two
Client and server, or it is to be understood that described client includes in previous embodiment one involved
Data synchronization unit, described server includes in previous embodiment two involved data synchronization unit,
Do not repeat them here.
The data synchronous system of the present embodiment, the performance of Appropriate application mobile terminal, carrying out data syn-chronization
Time the operation logic of data syn-chronization given mobile terminal (client) process, substantially reduce service
The pressure of device, is effectively increased the concurrent processing quantity of server.Meanwhile, server end need not safeguard
The mapping relations table of synchrodata client id and server end ID, simplifies simultaneously operating flow process.And
And, the present invention uses access credentials verification and the mode of message key encryption exchange data, improves service
Authentication mode mutual between device and client, decreases the number of times that server and client side is mutual, optimizes
Client and the browsing process of server, be effectively increased the efficiency of whole simultaneously operating.
One of ordinary skill in the art will appreciate that, realize all or part of step in above-described embodiment method
Can be completed by the hardware that program controls to be correlated with, described program can be stored in a computer-readable
Taking in storage medium, described storage medium can be ROM/RAM, disk, CD etc..
It should be appreciated that these are only the preferred embodiments of the present invention, it is impossible to therefore limit the present invention's
The scope of the claims, every equivalent structure utilizing description of the invention and accompanying drawing content to be made or equivalence flow process become
Change, or be directly or indirectly used in other relevant technical fields, be the most in like manner included in the patent of the present invention
In protection domain.
Claims (13)
1. a method of data synchronization, is applied to client, it is characterised in that include step:
Client obtains access credentials and message key from server, and described message key is after encryption and decryption
Data mutual between continuous client and server;
Client uses described access credentials to access server, to server for services device end number to be synchronized
According to;
The described server end data to be synchronized that client sends according to server carry out data synchronization processing;
After process completes, client carries out data synchronization processing according to data to be synchronized to described server end
Result obtain client Data Concurrent to be synchronized give server, so that server is according to described client
Data to be synchronized carry out data synchronization processing, and the result that confirmed service device sends;
After data syn-chronization has operated, the synchrodata in server includes that server ID identifies, client
Synchrodata in end includes that server ID mark and client id identify.
Method of data synchronization the most according to claim 1, it is characterised in that described client according to
Data to be synchronized to described server end carry out the result of data synchronization processing and obtain client data to be synchronized
Including: the last modification time of every pen data is stabbed the timestamp with the last synchronization and compares by client
Relatively, obtain the data having amendment after last simultaneously operating completes, and therefrom reject by described service
As client data to be synchronized after the data that device end data synchronization updating to be synchronized is crossed.
Method of data synchronization the most according to claim 1 and 2, it is characterised in that described access with
Demonstrate,prove by server address, user profile, client ip address or/and timestamp forms.
4. a method of data synchronization, is applied to server end, it is characterised in that include step:
Server generates access credentials and message key and is sent to client, and described message key is used for adding
Data mutual between deciphering subsequent client and server;
The access credentials that client is provided by server verifies;
When verification by after, server obtain server end Data Concurrent to be synchronized give client so that
Client carries out data synchronization processing according to described server end data to be synchronized;
Server receives the basis data to be synchronized to described server end of client transmission and carries out data syn-chronization
The client data to be synchronized that the result processed obtains, carry out data according to described client data to be synchronized
Synchronization process, and result is returned to client;
After data syn-chronization has operated, the synchrodata in server includes that server ID identifies, client
Synchrodata in end includes that server ID mark and client id identify.
Method of data synchronization the most according to claim 4, it is characterised in that described server obtains
Server end data to be synchronized include: the last modification time of every pen data is stabbed and the last by server
The timestamp synchronized compares, and obtains after last simultaneously operating completes and has the data of amendment as service
Device end data to be synchronized.
Method of data synchronization the most according to claim 4, it is characterised in that described method also includes:
Terminate alternately every time after, server update message key returns to client, for next time mutual time use.
7. according to the method for data synchronization described in any one of claim 4-6, it is characterised in that described visit
Ask voucher by server address, user profile, client ip address or/and timestamp forms.
8. a data synchronization unit, is applied to client, it is characterised in that include acquisition module,
One synchronization module and the second synchronization module, wherein:
Described acquisition module, for obtaining access credentials and message key, described message key from server
For data mutual between encryption and decryption subsequent client and server;
Described first synchronization module, is used for using described access credentials to access server, to server request
Server end data to be synchronized, carry out data according to the described server end data to be synchronized that server sends
Synchronization process;
Described second synchronization module, for after the first synchronization module has processed, synchronizes mould according to first
The result that block processes obtains client Data Concurrent to be synchronized and gives server, so that server is according to described
Client data to be synchronized carry out data synchronization processing, and the result that confirmed service device sends;
After data syn-chronization has operated, the synchrodata in server includes that server ID identifies, client
Synchrodata in end includes that server ID mark and client id identify.
Data synchronization unit the most according to claim 8, it is characterised in that described second synchronizes mould
Block is used for:
The last modification time of every pen data is stabbed and the last timestamp synchronized compares, obtain
Last simultaneously operating has data of amendment after completing, and therefrom reject by described server end treat with
As client data to be synchronized after the data that step data synchronized update is crossed.
10. a data synchronization unit, is applied to server end, it is characterised in that include signal generating unit,
Verification unit, the first lock unit and the second lock unit, wherein:
Described signal generating unit, is used for generating access credentials and message key and being sent to client, described in disappear
Breath key is for data mutual between encryption and decryption subsequent client and server;
Described verification unit, verifies for the access credentials providing client;
Described first lock unit, for when verification by after, acquisition server end Data Concurrent to be synchronized
Give client, so that client carries out data synchronization processing according to described server end data to be synchronized;
Described second lock unit, to be synchronized to described server end for receiving the basis of client transmission
Data carry out the client data to be synchronized that the result of data synchronization processing obtains, and treat according to described client
Synchrodata carries out data synchronization processing, and result is returned to client;
After data syn-chronization has operated, the synchrodata in server includes that server ID identifies, client
Synchrodata in end includes that server ID mark and client id identify.
11. data synchronization units according to claim 10, it is characterised in that described first synchronizes
Unit is used for: stabbed by the last modification time of every pen data and the last timestamp synchronized compares,
Obtain after last simultaneously operating completes and have the data of amendment as server end data to be synchronized.
12. data synchronization units according to claim 10, it is characterised in that described signal generating unit
Be additionally operable to: after terminating alternately every time, update message key and return to client, for next time mutual time make
With.
13. according to the data synchronization unit described in any one of claim 10-12, it is characterised in that described
Signal generating unit is used for: according to server address, user profile, client ip address or/and timestamp generates
Access credentials.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510173247.8A CN104780211B (en) | 2015-04-13 | 2015-04-13 | Method of data synchronization and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510173247.8A CN104780211B (en) | 2015-04-13 | 2015-04-13 | Method of data synchronization and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104780211A CN104780211A (en) | 2015-07-15 |
CN104780211B true CN104780211B (en) | 2016-09-07 |
Family
ID=53621445
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510173247.8A Active CN104780211B (en) | 2015-04-13 | 2015-04-13 | Method of data synchronization and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104780211B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101698274B1 (en) | 2015-09-03 | 2017-02-01 | 엘에스산전 주식회사 | Apparatus and method for data synchronizing of energy management system |
CN105915537A (en) * | 2016-05-27 | 2016-08-31 | 努比亚技术有限公司 | Token generation method, token calibration method and token authentication server |
CN108632300B (en) * | 2017-03-15 | 2021-12-10 | 阿里巴巴集团控股有限公司 | Data synchronization system, method, server, client and electronic equipment |
CN112052141B (en) * | 2020-09-02 | 2022-04-01 | 平安科技(深圳)有限公司 | Data fragment verification method and device, computer equipment and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103685333A (en) * | 2012-08-31 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Data synchronization method, terminal equipment, register server and web page server |
WO2014047385A3 (en) * | 2012-09-22 | 2014-06-05 | Nest Labs, Inc. | Subscription-notification mechanisms for synchronization of distributed states |
CN104202385A (en) * | 2014-08-27 | 2014-12-10 | 四川长虹电器股份有限公司 | Data backup and updating method of distributed file system |
CN104320447A (en) * | 2014-10-15 | 2015-01-28 | 新疆同晨信息技术有限公司 | Medium and small-sized cloud stored data synchronization method, compute readable medium and system |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102904887B (en) * | 2012-09-26 | 2016-01-20 | 东软集团股份有限公司 | The method of data synchronization of a kind of Web client and server and system |
CN103825917B (en) * | 2012-11-16 | 2017-11-21 | ***通信集团公司 | A kind of method of data synchronization, system, data synchronization server and terminal |
CN104301428B (en) * | 2014-10-29 | 2017-09-12 | 广州视源电子科技股份有限公司 | A kind of method of data synchronization and server |
-
2015
- 2015-04-13 CN CN201510173247.8A patent/CN104780211B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103685333A (en) * | 2012-08-31 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Data synchronization method, terminal equipment, register server and web page server |
WO2014047385A3 (en) * | 2012-09-22 | 2014-06-05 | Nest Labs, Inc. | Subscription-notification mechanisms for synchronization of distributed states |
CN104202385A (en) * | 2014-08-27 | 2014-12-10 | 四川长虹电器股份有限公司 | Data backup and updating method of distributed file system |
CN104320447A (en) * | 2014-10-15 | 2015-01-28 | 新疆同晨信息技术有限公司 | Medium and small-sized cloud stored data synchronization method, compute readable medium and system |
Also Published As
Publication number | Publication date |
---|---|
CN104780211A (en) | 2015-07-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107154852B (en) | Mobile terminal identity verification method for block chain application | |
US10630488B2 (en) | Method and apparatus for managing application identifier | |
CN109741039A (en) | Bookkeeping methods, terminal device, digs mine node and mine pond at mine pool server | |
KR100736091B1 (en) | Apparatus and method for managing a plurality of certificates | |
CN109561066A (en) | Data processing method and device, terminal and access point computer | |
CN104780211B (en) | Method of data synchronization and device | |
CN110958118A (en) | Certificate authentication management method, device, equipment and computer readable storage medium | |
CN112000744B (en) | Signature method and related equipment | |
US20190141048A1 (en) | Blockchain identification system | |
JP2009009541A (en) | Authentication system, terminal, server, authentication method, and program | |
CN105897715B (en) | Car networking intelligent data processing method | |
CN101771992A (en) | Method, equipment and system for protection of confidentiality of international mobile subscriber identifier IMSI | |
CN103973711A (en) | Verification method and device | |
CN104506527A (en) | Multidimensional information pointer platform and data access method thereof | |
CN106060078A (en) | User information encryption method, user registration method and user validation method applied to cloud platform | |
CN105847000A (en) | Token generation method and communication system based on same | |
CN105704160B (en) | Vehicle-mounted data real-time computing technique | |
CN105119716A (en) | Secret key negotiation method based on SD cards | |
Khieu et al. | CBPKI: cloud blockchain-based public key infrastructure | |
CN104717649A (en) | Method for remote control over wiping of software data of mobile terminal | |
CN110138558A (en) | Transmission method, equipment and the computer readable storage medium of session key | |
CN106021375A (en) | Database access method and database agent node | |
CN107171814A (en) | A kind of digital certificate updating method and device | |
US20130152179A1 (en) | System and method for user authentication using one-time identification | |
CN103580874B (en) | Identity identifying method, system and cipher protection apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |