home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 20091 < prev    next >
Encoding:
Text File  |  1992-12-30  |  3.8 KB  |  134 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!mostaccioli.cis.ohio-state.edu!marinell
  3. From: marinell@mostaccioli.cis.ohio-state.edu (tony marinello)
  4. Subject: VAX C RTL
  5. Message-ID: <1992Dec30.173401.4630@cis.ohio-state.edu>
  6. Sender: news@cis.ohio-state.edu (NETnews        )
  7. Organization: The Ohio State University Dept. of Computer and Info. Science
  8. Date: Wed, 30 Dec 1992 17:34:01 GMT
  9. Lines: 123
  10.  
  11.      Can I use c-rtl routines instead of qio's to communicate asynchronously 
  12. between two lat devices?   In this case the devices are a terminal and a 
  13. Hayes modem.  DSN%C gave me the following reply  to this question:
  14.  
  15. ...I have been digging far and wide and have been unable to come up with
  16. any examples using c rtl routines. There is currently no way to do
  17. asynchronous writes using the vax c rtl. There is a "rop=asy" option
  18. that can be specified on an open() or fopen(), but under the current
  19. implementation, only reads are performed asynchronously. This option
  20. corresponds to the rab$v_asy flag.
  21.  
  22. ...which means "yes" for reads(asynchronous) but no for writes.
  23.  
  24. The following code is an attempt to accomplish this end. In this case there is a
  25. Hayes modem with these characteristics:
  26.  
  27. Terminal: _LTA125:    Device_Type: Unknown       Owner: No Owner
  28.  
  29.    Input:   1200      LFfill:  0      Width:  80      Parity: None
  30.    Output:  1200      CRfill:  0      Page:    0
  31.  
  32. and a terminal with these characteristics:
  33.  
  34. Terminal: _LTA5050:   Device_Type: VT100         Owner: ME
  35. LAT Server/Port: DIAL/PORT_1
  36.  
  37.    Input:   9600      LFfill:  0      Width:  80      Parity: None
  38.    Output:  9600      CRfill:  0      Page:   24
  39.  
  40. $
  41.  
  42.  
  43.  
  44. ----------------------------------------- CUT HERE --------------------------------------------
  45. #include stdio
  46. #include unixio
  47. #include file
  48. #include ctype
  49. #include string
  50. #include processes
  51. main ()
  52.   {
  53.     FILE *fp,*wp,*fp2,*wp2,*ifp;
  54.     char buffer[21];
  55.     char buffer2[21];
  56.     int xxx, i,EXITFL=0;
  57.  /* get terminal name from VMS */
  58.     system("@DEV.COM");/* see end of message for this file */
  59.     ifp= fopen("TT.DAT","r");
  60.     fscanf(ifp,"%s",buffer);
  61.     fp = fopen (buffer, "r","rop=asy");/* the terminal */
  62.     wp = fopen (buffer, "w","rop=asy");
  63.     fp2 = fopen ("LTA125:", "r","rop=asy");/* the modem*/
  64.     wp2 = fopen ("LTA125:", "w","rop=asy");
  65.     printf("%s\n",buffer);
  66.     memset(buffer,0,20);
  67.     memset(buffer2,0,20);
  68.     if (fp == NULL)
  69.         perror ("fopen: ");
  70.     /* scans both devices  */
  71.     while (EXITFL!=-1)
  72.         {
  73.         xxx = fread(buffer, 20, 1, fp);
  74.         xxx = fread(buffer2, 20, 1, fp2);
  75.         /* If Read from TT: -write to LAT */
  76.         if (strlen(buffer) >= 1)
  77.                 {
  78.                 fwrite(buffer, 20, 1, wp2);
  79.                 if (strcmp(buffer,"q\n")==0)
  80.                         EXITFL=(-1);
  81.                 memset(buffer,0,20);
  82.                 }
  83.         /* If READ from LAT-write to TT: */
  84.         if (strlen(buffer2) >= 1)
  85.                 {
  86.                 fwrite(buffer2, 20, 1, wp);
  87.                 memset(buffer2,0,20);
  88.                 }
  89.         }
  90.     fclose (fp);
  91.     fclose (wp);
  92.     fclose (wp2);
  93.     fclose (fp2);
  94.     fclose (ifp);
  95.   }     
  96.  
  97. ....which fails miserably as the following shows:
  98.  
  99. $ run unixio3
  100. _LTA5048:
  101.  
  102. at
  103.  
  104. at
  105.  
  106. at
  107.  
  108. and the lat device returns...
  109. i6mJ4aB
  110. i6mJ4aB
  111. i6mJ4aB
  112.  
  113. ...trash in other words, however it works fine if both devices are the
  114. same lat device i.e. the same terminal.
  115.  
  116. If anyone knows if something like this can be done then reply to my
  117. address or the newsgroup. B.T.W., I'll be wearing my finest asbestos 
  118. outer-wear.
  119.  
  120. -Tony
  121.  
  122. -marinell@cis.ohio-state.edu
  123. -MARINELLO%ODNVMS.ODIN.ODIN.MRGATE.A1.decnet@osi.odn.ohio.gov
  124. **
  125. In file DEV.COM:
  126.  
  127. ERR= F$GETDVI("TT:","TT_PHYDEVNAM")
  128. $OPEN/WRITE OUTPUT_FILE  TT.DAT
  129. $WRITE/SYMBOL  OUTPUT_FILE ERR
  130. $CLOSE OUTPUT_FILE         
  131.  
  132. ...one can also use the appropriate system service call too.
  133.  
  134.