RSYNC and SCP differences

301

There are two main differences (that I can think of) between rsync and scp.

Before a file is transferred rsync takes the checksums of the file (MD5 and adler-32 I believe) and sends them to the receiver. After a file is transferred the receiver verifies the data integrity using those checksums. scp does not have such mechanism. scp uses ssh to transfer the data and although ssh uses checksums on the packet level that's a different story (I believe the default rsync behaviour is also to use ssh for transfers).

Another difference is what happens during a transfer retry. While scp will ignore any partially transferred set of files and overwrite them on the receiving end, rsync is more clever than that. Rsync will check the destination for any files present and if their signature matches that of the files on the sender side it will not retransmit these files. It might be possible to overwrite this behaviour but I am not entirely sure.

cheers, n

Share:
301
Sprengepiel
Author by

Sprengepiel

Updated on September 17, 2022

Comments

  • Sprengepiel
    Sprengepiel almost 2 years

    I´m just trying my first steps with version 2 of AFNetworking.

    Because of the new version the existing online tutorials like the afnetworking-crash-course by Ray Wenderlich doesn´t work anymore.

    From the AFNetworking 2 migration guide I´ve got the following code:

    https://github.com/AFNetworking/AFNetwor…Migration-Guide

    NSURL *URL = [NSURL URLWithString:@"http://example.com/foo.json"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]
    initWithRequest:request];
    operation.responseSerializer = [AFJSONSerializer serializer];
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"%@", responseObject);
    } failure:nil];
    [operation start];
    

    At this time I´ve already added the import

    #import "AFNetworking.h"
    

    to the .pch-file.

    The problem: I always get the error message, AFJSONSerializer is undeclared.

    What step did I forget?

    Best regards

    Frank

    • David Wong
      David Wong over 10 years
      Please mark the answer correct if it is. And welcome to Stack Overflow :D
  • user1364702
    user1364702 over 13 years
    I think Rsync sometimes tries to be smarter than it should; if you have a large file...a 200 meg video, for example...and you edit maybe 5 meg of it, rsync will (in a network copy) compare and transfer just that altered 5 meg. BUT if I did it with a mounted share, as in mounting a windows share and doing an rsync from directory A to directory B, rsync will copy the entire 200 meg. I was later told that only if it is transferring over the network will it do the differential copy, which speeds up the transfer job.
  • user1364702
    user1364702 over 13 years
    (in other words because I mounted the share in the filesystem, it treats it like a local drive-to-drive or volume-to-volume sync rather than machine-to-networked-machine sync)
  • Steven Monday
    Steven Monday over 13 years
    @Bart: You can use the --no-whole-file option to force rsync to use the delta-transfer algorithm on local-to-local copies.
  • user1364702
    user1364702 over 13 years
    @Steven-Thanks for that switch info. It's still something to keep in mind when assuming default behavior, though. That was the part that catches me off guard at times!
  • nayden
    nayden over 13 years
    @Bart: Thanks for the info. I was not aware of this rsync behavior.
  • Javier
    Javier over 13 years
    @nayden: rsync does not start by taking whole-file checksums.
  • nayden
    nayden over 13 years
    @Javier: spot on! ;)
  • peterh
    peterh about 7 years
    More explanation please, it looks like a copypasted logtext.