r/w to a modem

Charles Chi charles at ngpt.UUCP
Wed May 10 02:04:59 AEST 1989


I am running Xenix 2.2.3 on a Compaq 386. I am trying to write a 
program that accesses the modem (ie a "cu" type program).

Problem is, that my program accesses the modem properly when
calling other Xenix machines, but when it comes to calling 
BBS's and the such, I get zero response from the modem.

I do get connected to the remote modem, by I don't seem to be receiving
any characters (RxD light does not flicker on the modem).
Characters seem to be sending ok though.

I'd appreciate hearing from somebody who has experience in this area.

Here's a brief (greatly reduced for illustrative purposes) 
scenario of my program:

	int	fd;
	struct	termio term;

	main()
	{
		set_display();   /* setup the display eg. raw mode */

		set_shm();       /* create the shared memory to be used
				    for message passing between 
				    my "rx" and "tx" tasks */

		fd = open( "/dev/tty1A", O_RDWR|O_NDELAY);
		ioctl( fd, TCGETA, &term);
		term.c_cc[VMIN] = '\1';		/* set to "raw" mode */
		term.c_cc[VTIME] = '\0';
		term.c_flag &= ~ICANON;
		term.c_iflag |= ISTRIP;		/* strip 8th bit */
		ioctl( fd, TCSETA, &term);

		dial();          /* dial the modem. in this case, I
				    actually use /usr/lib/uucp/dial
				    to do the grunt work */

		if ( fork())	
			rx();	/* task to read incoming data from modem */
		else
			tx();	/* task to read data from the keyboard */
	}

	rx()
	{
		char	&c;

		/* attach the shared memory */

		while( read(fd, &c, 1) > 0) {
			/* if shared memory says it's ok to print */
			putchar(c);		/* display character
				     		   received on stdout */ 
		}
	}

	tx()
	{
		char c;

		/* attach the shared memory */

		while ( (c=getchar()){
			/* check for "hot key" */
			write( fd, &c, 1)	/* send character to
						   to modem */	
		}
	}



	=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	Thanks in advance!

	Charles Chi
	613-781-7282



More information about the Comp.unix.wizards mailing list