home *** CD-ROM | disk | FTP | other *** search
/ Oracle Video Server 3.0.3.1 / OVS_3031_NT.iso / win32 / sqlnet / net23 / client / cmdgetpu.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  1.4 KB  |  67 lines

  1. /*
  2.   $Header: /netrcs/RCS/oracle/network/tns/tnsapi/RCS/cmdgetpu.c,v 1.1 1995/09/13 16:02:20 mhill Exp $
  3. */
  4.  
  5. #ifndef TFTPDEF
  6. # include "tftpdef.h"
  7. #endif
  8.  
  9. extern FILE *file_open();
  10. extern void file_close();
  11. extern double t_getrtime();
  12.  
  13. void do_get(remfname, locfname)
  14. char *remfname;
  15. char *locfname;
  16. {
  17. #ifdef WIN32
  18.   if ( (localfp = file_open(locfname, (modetype == MODE_ASCII) ? "w" : "wb", 1)) == NULL)
  19. #else
  20.   if ( (localfp = file_open(locfname, "w", 1)) == NULL)
  21. #endif
  22.   {
  23.     err_ret("can't fopen %s for writing", locfname); 
  24.     return;
  25.   }
  26.  
  27.   totnbytes = 0;
  28.   
  29.   t_start();      /* start timer for statistics collecting */
  30.   
  31.   send_RQ(OP_RRQ, remfname, modetype);
  32.   fsm_loop(OP_RRQ);
  33.   
  34.   t_stop();       /* stop timer for statistics collecting */
  35.  
  36.   file_close(localfp);
  37.  
  38.   printf("Received %ld bytes in %.6f seconds\n", totnbytes, t_getrtime());
  39. }
  40.  
  41. void do_put(remfname, locfname)
  42. char *remfname;
  43. char *locfname;
  44. {
  45. #ifdef WIN32
  46.   if ( (localfp = file_open(locfname, (modetype == MODE_ASCII) ? "r" : "rb", 0)) == NULL)
  47. #else
  48.   if ((localfp = file_open(locfname, "r", 0)) == NULL)
  49. #endif
  50.   {
  51.     err_ret("can't fopen %s for reading", locfname); 
  52.     return;
  53.   }
  54.  
  55.   totnbytes = 0;
  56.   t_start();
  57.  
  58.   lastsend = MAXDATA;
  59.   send_RQ(OP_WRQ, remfname, modetype);
  60.   fsm_loop(OP_WRQ);
  61.  
  62.   t_stop();
  63.  
  64.   file_close(localfp);
  65.   printf("Sent %ld bytes in %.6f seconds\n", totnbytes, t_getrtime());
  66. }
  67.