home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP31.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program forces the remote end to send an XOFF, and
- * detects it by using isxoffblocked(). I send data to our UNIX
- * system which is running "cat > dummy" with "stty ixoff". I can't
- * reliably get XOFF chars until I get up to 38400.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int status;
-
- status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 10000, 10000,
- 38400L, P_NONE, 1, 8, ON, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- asixon( COM1, 30, 70, XON, XOFF );
- for ( ; ; ) {
- asiputs( COM1, "Lots of test data\n", -1 );
- if ( isxoffblocked( COM1 ) )
- break;
- if ( gfkbhit() )
- break;
- }
- printf( "Received an XOFF, waiting for an XON\n" );
- while ( isxoffblocked( COM1 ) ) ;
- printf( "Received an XON\n" );
- }