Actual source code: ex42.c
petsc-3.4.2 2013-07-02

      2: static char help[] = "Reads a PETSc vector from a socket connection, then sends it back within a loop. Works with ex42.m or ex42a.c\n";

      4: #include <petscvec.h>

      8: int main(int argc,char **args)
      9: {
     10:   Vec            b;
     11:   PetscViewer    fd;               /* viewer */
     13:   PetscInt       i;

     15:   PetscInitialize(&argc,&args,(char*)0,help);
     16:   fd = PETSC_VIEWER_SOCKET_WORLD;

     18:   for (i=0; i<1000; i++) {
     19:     VecCreate(PETSC_COMM_WORLD,&b);
     20:     VecLoad(b,fd);
     21:     VecView(b,fd);
     22:     VecDestroy(&b);
     23:   }
     24:   PetscFinalize();
     25:   return 0;
     26: }