Saturday, February 12, 2011

Do web service requests guarantee end of file is reached?

Hi, If I am transferring data over a web service, does it guarantee that the end of file was reached?

what about the data send, does it guarantee it wasn't corrupted somehow?

(using asp.net web services)

  • Hi,

    HTTP uses TCP for transport which includes error detection, and automatic re-send of corrupted data. The detection is quite robust but is not perfect: some errors still manage to go through.

    ASP.NET does not add any protection against data corruption on top of the one provided by TCP, so it is possible that your data gets corrupted during transfert.

    If you really need to ensure that your data has not been corrupted, you can hash your data, and send the generated hash along with the data in your request (or response). On the receiving side, hash the received data and compare the two hashes. If they differ, the data has been corrupted, and you can take appropriate measures.

    This technique is very robust: it is very, very improbable that the data and hash get corrupted in a way that they will still correspond.

0 comments:

Post a Comment