flow control question

John L. Wynstra john at bc-cis.UUCP
Sun Jan 1 02:15:25 AEST 1989


This may be a stupid question, but having had a go at the UNIX books without
finding the answer, I'm going to ask anyway (and don my asbestos suit :^)

First the setup.  My system (at work) is Altos's port of the Microsoft XENIX
5.0 system for their (Altos's) 386 boxes, the Altos 1000 and 2000.  I'm using
C to write to (and read from) a port.  The flow control is x-on/ x-off.
No stx/ etx or anything like that.

Now the problem in a nutshell.  My user (client) is in the habit of physically
disconnecting the port, and my C program (no apologies for the stupid algorithm,
I didn't write the original code) keeps sending its poo-poo down the port until
it fills the buffer, and I get x-offed, or so I'm thinking.  Anyway I have a
program that up and stops on me, and I have to find a way to deal with it.

What I'd like to know is: how can I, within a C program under XENIX, detect
the x-off?  Presumably I can set SIGALRM immediately before going into the
write() call, and timeout after an excessively long interval of time.
I could just assume that such a timeout means x-off and issue a ioctl(TCXONC),
but there must be a cleaner way to do this, I'm thinking.  Under XENIX or
for that matter AT & T's UNIX System V, is there a mechanism like ioctl() to
inquire of the device driver, "are you x-offed?"

-- john wynstra
  "the 40-year-old rookie"
work:	Soft Computer Consultants, 864 Williston Blvd., Albertson, N.Y. 11507
home:	Apt. 9G, 43-10 Kissena Blvd., Flushing, N.Y., 11355
					 ________________________________
	UUCP:	rutgers --> cmcl2 --,	| domain style: john at bc-cis.UUCP |
		ihnp4 --> allegra --|	`--------------------------------'
				    +--> phri --> bc-cis --> john
			princeton --|
			columbia  --'



More information about the Comp.unix.questions mailing list