home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / networking / misc / parpc04.lha / hardware / src / GET.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-13  |  1.1 KB  |  41 lines

  1. /* GET.C: Testing receipt of large amount data (without use of interrupts)
  2.  * 1. On the PC,    type: get
  3.  * 2. On the Amiga, type: machaddr 5
  4.  *                        dump 1 4
  5.  *
  6.  * When your interface & cables are ok, you will see dots appearing on the
  7.  * screen, each representing a packet successfully received. After each 15th
  8.  * packet the number of Kbytes received will be printed.
  9.  *
  10.  * Port address can be changed, it won't be interpreted yet.
  11.  */
  12. #include <stdio.h>
  13. #include "pardev.h"
  14.  
  15. /* hardware address of this machine */
  16. #define MYADDR 1
  17.  
  18. main(int argc,char **argv)
  19. {
  20. unsigned char buffer[4096+8];
  21. unsigned int Length,count=1;
  22. unsigned long total=0;
  23.  
  24.  paraddress(MYADDR,LPTADDR);
  25.  
  26.  printf("My address %d, reading data from 0x%04x \n",MYADDR,LPTADDR);
  27.  
  28.  while(1)                /* abort this with a CTRL-C */
  29.  if (pardataready())
  30.  {
  31.   Length=parread(buffer,4096+8);  /* max. packetsize to receive is 4104 */
  32.   if (Length >0)
  33.   {
  34.     total += Length;
  35.     if (!(count++ & 15)) printf("Got %d KB\n",total/1024);
  36.     else printf(".");
  37.   }
  38.   else printf("ERROR %d\n",Length);
  39.  }
  40. }
  41.