telnet character by character

telnet character by character

Post by Vincent Tk » Thu, 13 Oct 1994 03:30:58



Greetings,
   I am using telnet to connect to a port attached to a piece of server
software I wrote.  I would like telnet to go into character by character mode
automatically.  I have tried using send() to send out-of-band data to telnet
to tell it that should use this mode  but I must be missing something.
(If I use the telnet break key then enter mode character, everything is
fine.)  Any suggestions would be greatly appreciated.

Thanks,
   Vince Tkac

 
 
 

telnet character by character

Post by Vincent Tk » Fri, 14 Oct 1994 00:24:15


I have tried to send the following commands to the telnet client:

IAC DO TELOPT_SGA
IAC DONT TELOPT_LINEMODE
IAC WONT TELOPT_LINEMODE
IAC DO TELOPT_ECHO
IAC DO ECHO
IAC DONT DET

with the following code.

msg[0] = IAC;           msg[1] = DO;            msg[2] = TELOPT_SGA;
send(newsockfd, msg, 3, MSG_OOB)
msg[0] = IAC;           msg[1] = DONT;          msg[2] = TELOPT_LINEMODE;
send(newsockfd, msg, 3, MSG_OOB)
msg[0] = IAC;           msg[1] = WONT;          msg[2] = TELOPT_LINEMODE;
send(newsockfd, msg, 3, MSG_OOB)
msg[0] = IAC;           msg[1] = DO;            msg[2] = TELOPT_ECHO;
send(newsockfd, msg, 3, MSG_OOB)
msg[0] = IAC;           msg[1] = DO;            msg[2] = ECHO;
send(newsockfd, msg, 3, MSG_OOB)
msg[0] = IAC;           msg[1] = DONT;          msg[2] = 20;  /* DET */
send(newsockfd, msg, 3, MSG_OOB)

Can anyone tell me what I am doing wrong here?  The terminal seems not to
be echoing anything but does accept input (in line mode).

Thanks,
   Vince Tkac


 
 
 

telnet character by character

Post by David Ba » Sun, 16 Oct 1994 06:18:54



>I have tried to send the following commands to the telnet client:
>IAC DO TELOPT_SGA
>IAC DONT TELOPT_LINEMODE
>IAC WONT TELOPT_LINEMODE
>IAC DO TELOPT_ECHO
>IAC DO ECHO
>IAC DONT DET
>with the following code.

[code deleted]

Quote:>Can anyone tell me what I am doing wrong here?  The terminal seems not to
>be echoing anything but does accept input (in line mode).

I think you need to use WILL instead of do.  I wrote a BBS a few years
that you could access through telnet (like a MUD), and here is what I
did:

  sprintf(mesg,"%c%c%c",IAC,WILL,TELOPT_ECHO);   /* put client in no local */
  writestr(&id,mesg,3);                          /* echo, character mode   */
  get_n_bytes(&id,mesg,3);
  sprintf(mesg,"%c%c%c",IAC,WILL,TELOPT_SGA);
  writestr(&id,mesg,3);
  get_n_bytes(&id,mesg,3);

I turned off echo, and had the program write back any characters that
need to be echoed.

David
--
   /David Barr   (206)685-8129   University of Washington           /
  /Systems Programmer           Medical Centers Information Systems/

/        http://alfred1.u.washington.edu:8080/~davidb/           /

 
 
 

1. telnet line-by-line to character-by-character

I know that telnet can be set manually to character-by-charater, but is
there a way to do it from a c program?  How do you make a telnet connection
emulate a terminal if you want the telnet session to have NOECHO,
CBREAK capabilities - in other words, it should return after each
character (NOT after a return) and it should not echo characters
locally (it should depend on the other side to do that).  I've got
the no-echo down by sending a string, but I can't figure out what
to send for the other thing.

Thanx.

Tim Goldenburg
--

--
There is no emotion, there is peace.
There is no ignorance, there is knowledge.
There is no passion, there is serenity.
There is no death, there is The Force.
                  -Jedi Code
------------------------------------------

2. /proc file system problem

3. character-by-character mode through telnet

4. Linux support for SparQ and JAZ

5. Replacing characters with end of line character

6. HP4P + Ghostscript & HP 4P VS HP 4 MP

7. Traversing character by character

8. time-wait state problem

9. Replace character with accent by character without accent

10. ibm2asc Filter 8-bit Scandinavian characters to 7-bit characters

11. Unicode characters to multibyte characters.

12. how to read a text file and write it into a new file character by character?

13. Character set assigments (Re: How do I display IBM PC characters?)