Case 8000 Series Reference Manual page 158

8000 series
Table of Contents

Advertisement

/********************************************************************************************/
/*
TITLE : Printer TELNET application
/********************************************************************************************/
/*
set #define constants for BSD_4_2+ ULTRIX*/
#include <sys/types/h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <signal.h>
#define DSTPORT 2000
#define NULADDR (struct sockaddr *)
#define TYPE SOCK_STREAM
#define LINGER_TIME 1
#define BUFF_SIZE 512
char buff[ BUFF_SIZE ];
int newline = 0 ;
char previous = '\000';
int sock = -1;
char *progname;
int expand = 0;
main( argc, argv)
register int argc;
register char *argv[];
{
int size;
struct sockaddr_in addr;
struct linger optval;
struct hostent *gethostbyname(), *raddr;
interrupts()
/*
Verify the parameters and make a connection
if ((argc < 2) || (argc > 4 ))
error( "Usage: %s host-name [port] [-n]" , argv[0] );
if (argc ==4)
{
if (strcmp(argv[3], "-n") )
error ("Usage: %s host-name [port] [-n]" , argv[0] );
else
expand = 1;
}
if ((argc == 3) && (strcmp(argv[2], "-n") == 0 ) )
expand = 1;
progname = argv[0];
if ((raddr = gethostbyname(argv[1]) ) == 0)
error("Unknown host %s", agrv[1] );
addr.sin_addr.s_addr = *((long *) raddr->h_addr);
X870-300351 Issue 1
/* Default TCP port number - dec. - 1 per app*/
/* System assigns socket address
/* Sequenced, reliable two way connection
/* Buffer to hold text in transit
/* non-zero(2 then 1) when CR RETURN found
/* remember the previous character
/* Socket descriptor (like a file descriptor
/* program name o/p with error messages
/* True when option to expand \r to \r\n selected
/* Number of bytes in the buffer
/* Describes socket connection
/* for setting socket option
/* For finding internet address
/* Be prepared for interrupts
H-2
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
Rev.0

Advertisement

Table of Contents
loading

This manual is also suitable for:

832584258525

Table of Contents