Added a "-D" option to set the TCP_NODELAY socket option.

This commit is contained in:
David Greenman 1995-05-03 06:25:56 +00:00
parent 6de98b5d98
commit 8d34651b6c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8232
2 changed files with 18 additions and 5 deletions

View File

@ -39,7 +39,7 @@
.Nd remote login
.Sh SYNOPSIS
.Ar rlogin
.Op Fl 8EKLdx
.Op Fl 8DEKLdx
.Op Fl e Ar char
.Op Fl k Ar realm
.Op Fl l Ar username
@ -63,6 +63,11 @@ option allows an eight-bit input data path at all times; otherwise
parity bits are stripped except when the remote side's stop and start
characters are other than
^S/^Q .
.It Fl D
The
.Fl D
option sets the TCP_NODELAY socket option which can improve interactive response
at the expense of increased network load.
.It Fl E
The
.Fl E

View File

@ -53,6 +53,7 @@ static char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93";
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <errno.h>
#include <fcntl.h>
@ -150,10 +151,10 @@ main(argc, argv)
struct servent *sp;
struct sgttyb ttyb;
long omask;
int argoff, ch, dflag, one, uid;
int argoff, ch, dflag, Dflag, one, uid;
char *host, *p, *user, term[1024];
argoff = dflag = 0;
argoff = dflag = Dflag = 0;
one = 1;
host = user = NULL;
@ -172,15 +173,18 @@ main(argc, argv)
}
#ifdef KERBEROS
#define OPTIONS "8EKLde:k:l:x"
#define OPTIONS "8DEKLde:k:l:x"
#else
#define OPTIONS "8EKLde:l:"
#define OPTIONS "8DEKLde:l:"
#endif
while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != EOF)
switch(ch) {
case '8':
eight = 1;
break;
case 'D':
Dflag = 1;
break;
case 'E':
noescape = 1;
break;
@ -337,6 +341,10 @@ main(argc, argv)
setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) < 0)
(void)fprintf(stderr, "rlogin: setsockopt: %s.\n",
strerror(errno));
if (Dflag &&
setsockopt(rem, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) < 0)
perror("rlogin: setsockopt NODELAY (ignored)");
one = IPTOS_LOWDELAY;
if (setsockopt(rem, IPPROTO_IP, IP_TOS, (char *)&one, sizeof(int)) < 0)
perror("rlogin: setsockopt TOS (ignored)");