Logo 
Search:

Networking Articles

Submit Article
Home » Articles » Networking » TCP/IPRSS Feeds

TCP/IP program to move a character from the keyboard to the socket

Posted By: Milind Mishra     Category: Networking     Views: 2156

TCP/IP program to move a character from the keyboard to the socket.

Code for TCP/IP program to move a character from the keyboard to the socket in Networking

#include <sys/types.h>
#include <stdio.h>
#include "telnet.h"
#include "local.h"/*ARGSUSED*/int
soputc(FILE *sfp, FILE *tfp, int c)
{
    if (sndbinary) {
        if (c == TCIAC)
            (void) putc(TCIAC, sfp); /* byte-stuff IAC    */
        (void) putc(c, sfp);
        return 0;
    }
    c &= 0x7f;    /* 7-bit ASCII only */if (c == t_intrc || c == t_quitc) {    /* Interrupt        */
        (void) putc(TCIAC, sfp);
        (void) putc(TCIP, sfp);
    } elseif (c == sg_erase) {        /* Erase Char        */
        (void) putc(TCIAC, sfp);
        (void) putc(TCEC, sfp);
    } elseif (c == sg_kill) {        /* Erase Line        */
        (void) putc(TCIAC, sfp);
        (void) putc(TCEL, sfp);
    } elseif (c == t_flushc) {        /* Abort Output        */
        (void) putc(TCIAC, sfp);
        (void) putc(TCAO, sfp);
    } else
        (void) putc(c, sfp);
    return 0;
}
  
Share: 



Milind Mishra
Milind Mishra author of TCP/IP program to move a character from the keyboard to the socket is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!