Case 8000 Series Reference Manual page 159

8000 series
Table of Contents

Advertisement

if ((argc == 4) || ((argc == 3) && (expand == 0) ) )
addr.sin_port = atoi( argv[2] );
else
addr.sin_port = DSTPORT;
addr.sin_port = htons(addr.sin_port);
addr.sin_family = AF_INET;
/* Create a communication end point*/
if ((sock = socket( AF_INET, SOCK_STREAM, 0 )) < 0)
error ("socket failed");
/* linger a second after close request before chopping connection, in case
/* of any buffer flushing probs
optval.l_onoff = 1;
optval.l_linger = LINGER_TIME;
if (setsockopt(sock,SOL_SOCKET,SO_LINGER,&optval,sizeof(optval))<0)
error( "failed to set LINGER option");
/* Make a connection request */
if
(connect( sock, &addr, sizeof(addr) ) < 0 )
error( "connect failed");
/* Transfer the data */
write( sock, "\033\065\001",3);
while (more_data( buff, &size ))
{
if (write( sock, buff, size ) != size)
error ("write failed");
}
if (size)
{
if
(write( sock, buff, size) != size)
error("write failed");
}
write (sock, "\014",1);
close( sock );
}
/* .............. MORE_DATA .............. */
int more_data( array, size)
register char *array;
register int *size;
{
register int c;
/* temp storage for characters
/* Put data into buffer from standard input stream
/* TELNET requires CR LF to be sent as "\r" + "\r\n" to "\r
for ( *size = 0 ; *size < BUFF_SIZE ; (*size)++ )
{
if (expand)
{
X870-300351 Issue 1
/* Byte flip port number
/* Data buffer filled from stdin
/* Returns number of bytes in data buffer
/* Requested port number - decimal
/* Default port number
/* ESC 5 1 (Begin Autoline Feed mode)
/* While not EOF write away buffer
/* Write FF
/* option to convert \n to \000\n
H-3
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
Rev.0

Advertisement

Table of Contents
loading

This manual is also suitable for:

832584258525

Table of Contents