telnet echo nagotiations

This is a discussion on telnet echo nagotiations within the Networking/Device Communication forums, part of the General Programming Boards category; I know this is not much of a programming question, but I had no other place to go to... I ...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    telnet echo nagotiations

    I know this is not much of a programming question, but I had no other place to go to...


    I alittle help with telnet echo nagotiations.
    you see, I'm writing a server, and I know that the server needs to send the 0xff 0xfb 0x01 to let the client know that his with remote echo the sent to him data.

    and the client needs to send back: 0xff 0xfd 0x01


    The thing is that, when server sends this 3 bytes to the client, the client does understand that this bytes are part of the nagotiation.


    what am I doing wrong?



    Thanks alot.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    Can we assume you've read the relevant RFC's regarding telnet?

    > what am I doing wrong?
    Not posting some code?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i was unable to find the right rfc, because there are more than one on the telnet protocol.

    but I did sit with a sniffer and looked at what the telnet server is sending, and that was 0xff 0xfb 0x01, and the sniffer even identified it as a "the server will echo" and the client answers: "do echo" which is: 0xff 0xfd 0x01


    if you have the right rfc, I would love to read it.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Check the telnet client you are using as well. I have 5 different telnet clients that I use to test my socket programming, and I have 5 different variations on behavior. In fact, only one of the telnet clients by default actually deals with OOB data when the connection is established (I think it's TTerm Pro, I also use Nifty Telnet, IVT Freeware Telnet, windows telnet and cygwin's telnet).

    I never really dived into the telnet RFC's much because the behavior I am looking for is in a MUD (line input, nothing fancy, any problems just drop connection and re-connect), so 4 of my 5 telnet clients made me happy, and the 5th made me add in a response to ignore the intial OOB handshake (resulting in about a 2 second delay for clients that don't initially send the handshake data).

    Hope this helps.

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    the thing is that i have 2 clients:

    the one is the windows 98's client, and putty client.

    the thing is, that for the windows' one i need to send back the input from the client so i'll see in the client what i'm typing.

    but with putty, because i didn't do any negotiations it activates a local echo, so when my server sends back the input, in the putty client i see double what i type in it.


    I want to do the hand shake (the negotiation), but how?
    because I guess what I saw in the sniffer is wrong or something, and I can just send() back what i recv() from the client...
    Last edited by Devil Panther; 11-17-2003 at 02:48 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  6. #6
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    The way I learned what each of my telnet clients was doing was to write a very simple server. Once it was connected to by a client, it would simply echo the character and the ASCII code of that character to the standard output (cout). Connect to server, watch for output, start typing in telnet client, watch output. You could also have your telnet client send the OOB data and watch in the server console what bytes are actually being sent across.

    This could be extended by giving the server marginally more function and allowing it to type back to the client. For example, if you type 'A' in the server window, it will send the "0xff 0xfb 0x01" to the telnet client, and then you can see what (if anything) the telnet client is sending back to the server in response. (This way you don't have to keep re-connecting to the server just to have it send the bytes to the client again unless your telnet client won't change behavior without re-connecting itself).

    Beej's guide has a relatively simple server that you could easily modify for this purpose (in fact, the server as written will already just echo the text back, all you would need to add would be the ASCII #'s in the output). Do a search for "Beej" and you should find it easily.

    Alternatively, you could dig deeper into the telnet RFC's. (I'm so glad I don't care what size the client's terminal is going to be or whether it is echoing local text, etc. MUDs don't care about that stuff, just send raw lines of text! Muhahaha!)

  7. #7
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i checked with the sniffer again, and this is what i got:

    the server sends the client an IAC WILL ECHO (0xff 0xfb 0x01)
    and the client sends back an IAC DO ECHO (0xff 0xfd 0x01)

    the funny thing is, that some servers send the will echo, and others send do echo...

    I don't know what to do, how can I let the client know that I am going to remote echo, so the client won't need to auto echo locally...


    btw, what is this MUD and OOB?



    Thanks again.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  8. #8
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Well, a MUD is a multi-user-dungeon (a text based adventure game played in real-time via a telnet connection). There are tons of 'em out there, and I'm writing yet another one.

    OOB stands for Out-Of-Band data which is what the IAC Do Echo stuff is - out of the normal realm of what data is being transferred between the client and the server.

    Normally the client is typing away, interacting with the server in whatever capacity the server is set up for (a unix shell, for example) and the server is responding appropriately. But say the telnet client re-sizes the window. In order for the client to inform the server of the new window size, it has to send OOB data, which is the special characters the telnet RFC defines. When the server sees those characters, it says, "Hey, the telnet program just resized it's window, I need to adjust how I'm sending text to display it appropriately". Not all telnet sessions need to deal with all types of OOB data.

    You should read up more on the telnet RFC's (do a google search just for "telnet RFC" and you'll get alot of hits).

  9. #9
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    well rfc857 does talk about the echo negotiation... but it doesn't say what the server and the client suppost to send.

    also, this negotiation can take place in the middle and not only at the beginning (if I undertood it right), so what tells the other side, if it's just data or the negotiation?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with telnet and tcp
    By hoAx in forum Windows Programming
    Replies: 11
    Last Post: 03-11-2008, 03:03 PM
  2. C Execl Telnet
    By karcheee in forum C Programming
    Replies: 1
    Last Post: 04-26-2005, 03:31 PM
  3. A breakthrough
    By loopy in forum Linux Programming
    Replies: 4
    Last Post: 11-26-2003, 06:46 PM
  4. C-Shell Scripting.. Help!
    By denizengt in forum Tech Board
    Replies: 3
    Last Post: 10-29-2003, 01:37 PM
  5. telnet!!
    By bigB8210 in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-13-2003, 06:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21