Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

When data is sent from a client to a server ,how will the server make sure that it has received all the data accurately ? ie how to ensure that the server has received all the data sent by the client.
Thanks
Dev
Posted

1 solution

This should be defined by your application-level communication protocol. (http://en.wikipedia.org/wiki/Application_layer[^].)

I would advise that the protocol should carry some redundancy and meta-data. The serialized data sent should better be "prefixed". For example, on the top of protocol, you are sending and receiving some variable number of data elements. Start it with sending the number of data elements receiving party should expect. Same thing goes for each data element and each part of it, hierarchically. When it comes to an individual string, first send the length of it (and probably some meta-data information like encoding of it). This way, each receiving party will maintain the integrity of each communication on every step.

—SA
 
Share this answer
 
v3
Comments
Rajesh Anuhya 1-Feb-12 2:34am    
Good answer, have my+5
--RA
Sergey Alexandrovich Kryukov 1-Feb-12 2:50am    
Thank you, Rajesh.
--SA
Amir Mahfoozi 1-Feb-12 3:03am    
+5
Sergey Alexandrovich Kryukov 1-Feb-12 3:07am    
Thank you, Amir.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900