11 Replies Latest reply: Sep 11, 2009 2:43 AM by EJP RSS

    file transfer

    807580
      Hi,

      I have two servers in two different locations. Two server's will have their own copy of a file as below

      \\server1\test.pdf - file size is 350 kb
      \\server2\test.pdf - file size is 350 kb

      If I overwrite test.pdf in server1 with a new file test.pdf which is 800 kb in size then the difference bytes alone should get updated in the server2 - test.pdf.

      Is there any way to do this.
        • 1. Re: file transfer
          807580
          You want to send a diff from server1 to server2? That would be a fairly expensive task which likely needs more bytes to transfer, because you need information about the positions of the new bytes as well. Why don't you just send the complete file?
          • 2. Re: file transfer
            796440
            BalusC wrote:
            You want to send a diff from server1 to server2? That would be a fairly expensive task which likely needs more bytes to transfer, because you need information about the positions of the new bytes as well. Why don't you just send the complete file?
            It's especially likely to be expensive with a binary format like PDF.
            • 3. Re: file transfer
              807580
              will it be less expensive to do a complete transfer then transferring just the difference?
              • 4. Re: file transfer
                796440
                coded_java wrote:
                will it be less expensive to do a complete transfer then transferring just the difference?
                That depends. But for a binary file such as PDF, it will be difficult and expensive (time-wise and space-wise) to produce a delta. It's unlikely you'll gain much by trying to do it that way for a PDF.
                • 5. Re: file transfer
                  807580
                  Indeed, diffs are only valuable in when used with text files. But in binary files .. You never know. Adding only one sentence in a PDF file might deliver a completely different binary output where in only the few leading and trailing bytes bight be still the same.
                  • 6. Re: file transfer
                    796440
                    BalusC wrote:
                    Indeed, diffs are only valuable in when used with text files. But in binary files .. You never know. Adding only one sentence in a PDF file might deliver a completely different binary output where in only the few leading and trailing bytes bight be still the same.
                    Small changes are not likely to result in large deltas in the file, but representing those deltas is in general not well defined.

                    Now, it's conceivable that there exists some PDF diff utility that produces a compact format for things like "change font of words 35-98 of paragraph 2 to Arial", etc., and a tool to apply those diff results to an existing PDF. If so, then the OP may be better off sending the diff. But if he's not using such a tool (and I'm assuming he's not), then a line-based text diff is a very bad idea, for at least 3 reasons that I can think of.

                    1. It's not a line-based text file, so there may be few or no EOL characters. If you have an 800 kB file with only 10 EOL characters, then you'll be sending 80 kB for a single character difference.

                    2. It's a binary file, not a text file, so a standard text diff tool will probably choke on the bytes that don't make valid characters.

                    3. Crud. I forgot the third reason, but there was one.
                    • 7. Re: file transfer
                      jschellSomeoneStoleMyAlias
                      Not to mention of course that sending a 1 meg file should take less than a second.
                      And one could always zip it.
                      And should one be concerned that the file on the original computer changed before the diff is returned from the second? If possible at all then sending the diff is worthless and dangerous.
                      • 8. Re: file transfer
                        EJP
                        Not to mention that establishing what the diff is will require transporting one or both of the files to another location. So there is no possible advantage in the first place.
                        • 9. Re: file transfer
                          807580
                          WIth all your responses it seems that transferring the difference bytes will be resource consuming right.

                          So should I check some other alternative with the requirement that I posted in my first message.
                          • 10. Re: file transfer
                            796440
                            coded_java wrote:
                            So should I check some other alternative with the requirement that I posted in my first message.
                            Some alternative like just sending the whole file, maybe, as already suggested?
                            • 11. Re: file transfer
                              EJP
                              transferring the difference bytes will be resource consuming
                              Almost certainly more so than transferring the whole file.
                              So should I check some other alternative with the requirement that I posted in my first message.
                              The requirement that you posted in your first message was that 'the difference bytes alone should get updated'. So this latest question is self-contradictory.