Path: utzoo!mnetor!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!umix!nancy!eecae!super.upenn.edu!rutgers!mtunx!whuts!homxb!hou2d!n2dsy From: n2dsy@hou2d.UUCP (G.BEATTIE) Newsgroups: comp.protocols.tcp-ip Subject: Asynchronous Framing Technique Software: TEST2.C Message-ID: <1976@hou2d.UUCP> Date: 7 Apr 88 19:46:07 GMT Organization: AT&T Bell Laboratories, Holmdel Lines: 190 Keywords: AFT, a SLIP Alternative - Test and Demo Programme /* This is a test program for the AFT system. Version 1.0, by John Howell (N2FVN), Copyright August 7, 1987 This software is free for non-commercial use. All commercial rights are retained by the author or his designees. Commercial use without the explicit written permission of the author is prohibited. This package is provided on an 'as is' basis without warranty. Send and receive frames. Machine dependant for the PC with async driver installed. Requires Microsoft C 4.0. */ #include "stdio.h" #include "conio.h" #include "dos.h" #include "fcntl.h" #include #include #include "io.h" #include "stdlib.h" int async_handle; main() { char ebdt, c, level, suff_str[10], suff_len; char in_str[256], out_str[256]; int out_busy; int rx_max, in_len, out_len, i, match, tc; printf("AFT Test Program 2\n"); printf("Send and receive frames over COM1: using ASYNC driver.\n"); async_handle = open("ASYNC1", O_RDWR | O_BINARY); if (async_handle == -1) { printf("Open of async driver failed. errno=%d\n", errno); printf("Make sure ASYNC.BIN is included in CONFIG.SYS.\n"); exit(1); } printf("Eight-bit data transparency (y/n)?"); scanf("%1s",&c); ebdt = c == 'y' || c == 'Y'; printf("Transparency level (0-2)?"); scanf("%d",&level); printf("Suffix string (HEX)?"); get_array(suff_str, &suff_len); rx_max = sizeof(in_str) - 2; aft_options(ebdt, level, suff_len, suff_str, rx_max); aft_rx_start(in_str); out_len = 0; out_busy = 0; printf("Enter characters to fill transmit buffer. Return to send.\n"); printf("Enter empty line to exit.\n\n"); while (1) { if (async_char_waiting()) { if (aft_rx_char(async_get_char())) { in_len = aft_rx_complete(); printf("Frame received. Length=%d data:", in_len); for (i=0; i