Run.

def Run(self, args):
    """Run."""

    # Open the file.
    fd = vfs.VFSOpen(args.pathspec, progress_callback=self.Progress)

    if args.address_family == rdf_client_network.NetworkAddress.Family.INET:
      family = socket.AF_INET
    elif args.address_family == rdf_client_network.NetworkAddress.Family.INET6:
      family = socket.AF_INET6
    else:
      raise RuntimeError("Socket address family not supported.")

    s = socket.socket(family, socket.SOCK_STREAM)

    try:
      s.connect((args.host, args.port))
    except socket.error as e:
      raise RuntimeError(str(e))

    cipher = rdf_crypto.AES128CBCCipher(args.key, args.iv)
    streaming_encryptor = rdf_crypto.StreamingCBCEncryptor(cipher)

    while True:
      data = fd.read(self.BLOCK_SIZE)
      if not data:
        break

      self.Send(s, streaming_encryptor.Update(data))
      # Send heartbeats for long files.
      self.Progress()

    self.Send(s, streaming_encryptor.Finalize())
    s.close()

    self.SendReply(fd.Stat())