HAVING PROBLEM WITH CANONICAL READS ON A TTY.

ITEM: RTA000017834



                                                                                
                                                                                
                                                                                
QUESTION:                                                                       
We are working on an application that is doing canonical reads and              
writes on a tty port.  As I understand, a canonical read only receives          
the data when in our case a  is sent to indicate the end of the             
data block.  We are getting all the data fine minus the , which is          
ok.  However, when we do a write to the port, all the data is being             
sent, and again, the  is the end of block flag, and it is left              
out of the transmission.  However, the device on the other end, a               
special hand held terminal, is programmed to expect a  to                   
signify the end of data.  Is there anyway to get the system to send             
the  using canonical reads?                                                 
                                                                               
---------- ---------- ---------- --------- ---------- ----------                
A: From Info (Understanding the POSIX Line Discipline):                         
 In canonical mode input processing, terminal input is processed                
 in units of lines.  A line is deliminted by a new-line  (ascii LF)             
 character, and end-of-file (EOF) character, or an end-of-line(EOL)             
 character.  This means that a program attempting to read will be               
 blocked until an entire line has been typed or a signal has been               
 received.  Also, regardless of how many characters are requested in            
 the read, no more than one line will be returned.                              
                                                                                
 ICANON applies only to input mode (read), not to output mode (write).          
                                                                                
 The usual posix settings are (- means OFF, + means ON):                        
   -INLCR   Map NL to CR on input                                               
   -IGNCR   Ignore CR                                                          
   +ICRNL   Map CR to NL on input                                               
   ------                                                                       
   +OPOST   Postprocess output (this must be ON for other for                   
             the other flags below to work)                                     
   +ONLCR   Map NL to CR-NL on output                                           
   -OCRNL   Map CR to NL on output                                              
   -ONLRET  Map NL to CR on output                                              
                                                                                
 You probably want to experiment with some of these settings until              
 you are receiving/sending what you want.                                       
                                                                                
 Another choice is to turn off OPOSTand explicitly write out                    
 a '\r'instead of (or in addition to) a '\n'.                                   
 For instance, "write(fn,"hello\r",6);                                          
                                                                               
---------- ---------- ---------- --------- ---------- ----------                
                                                                                
                                                                                
This item was created from library item Q524439 1992 IJHF1                      
                                                                                
S e a r c h - k e y w o r d s:                                                  
CANONICAL COMMUNICATIO HAVING IJHF1 IX MAR91 PROBLEM READS RISCC                
RISCSYSTEM SOFTWARE TTY                                                         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000017834 ITEM: RTA000017834
Dated: 07/1998 Category: RISCAPRT
This HTML file was generated 99/06/24~12:43:07
Comments or suggestions? Contact us