Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!cmcl2!brl-adm!adm!scott@gateway.mitre.ORG From: scott@gateway.mitre.ORG Newsgroups: comp.unix.wizards Subject: Telnet flow control Message-ID: <7758@brl-adm.ARPA> Date: Tue, 9-Jun-87 07:33:55 EDT Article-I.D.: brl-adm.7758 Posted: Tue Jun 9 07:33:55 1987 Date-Received: Fri, 12-Jun-87 01:53:48 EDT Sender: news@brl-adm.ARPA Lines: 66 About every couple of months some complains about loosing characters over telnet. Well, telnet runs over TCP and TCP does NOT drop characters. The problem is that the distributed telnet turns off local flow control (UCB telnet that is, I can't speak for other telnets). Here is a modified ``mode'' function taken from a 4.2bsd telnet that reinstates local flow control. I have heard that the 4.3 telnet is similar but I haven't had the need to change it yet. John As always Mr. Scott, should you or any of your IM force be caught or killed, the secretary will disavow any knowledge of the operation. You're on your own John. Good Luck! struct tchars notc = { -1, -1, -1, -1, -1, -1 }; struct ltchars noltc = { -1, -1, -1, -1, -1, -1 }; mode(f) register int f; { static int prevmode = 0; struct tchars *tc; struct ltchars *ltc; struct sgttyb sb; int onoff, old; if (prevmode == f) return (f); old = prevmode; prevmode = f; sb = ottyb; switch (f) { case 0: onoff = 0; tc = &otc; ltc = &oltc; break; case 1: case 2: sb.sg_flags |= CBREAK; if (f == 1) sb.sg_flags &= ~(ECHO|CRMOD); else sb.sg_flags |= ECHO|CRMOD; sb.sg_erase = sb.sg_kill = -1; tc = ¬c; tc->t_stopc = otc.t_stopc; /* hacks to allow */ tc->t_startc = otc.t_startc; /* flow control */ ltc = &noltc; onoff = 1; break; default: return; } ioctl(fileno(stdin), TIOCSLTC, (char *)ltc); ioctl(fileno(stdin), TIOCSETC, (char *)tc); ioctl(fileno(stdin), TIOCSETP, (char *)&sb); ioctl(fileno(stdin), FIONBIO, &onoff); ioctl(fileno(stdout), FIONBIO, &onoff); return (old); }