aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Initialising the Telnet options with the client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Initialising the Telnet options with the client" Watch "Initialising the Telnet options with the client" New topic
Author

Initialising the Telnet options with the client

J Sock
Greenhorn

Joined: Feb 03, 2013
Posts: 1
Hi,

I am writing a Telnet server in Java and am finding it difficult to handle the initial client (using PuTTY in this case) options:

The Telnet protocol states that first, the client sends the server 3-byte codes beginning with 255 which state the Telnet options. Hence, I first read the bytes sent in using the BufferedReader's read() method (which returns an integer). I then convert the second byte of each 3-byte code to disable the option in the manner stated in this thread. My response is then sent. However, the client doesn't respond back with more options until I send it yet another stream of data. (Its response in my case being: 255 251 36.) It doesn't seem to matter what I send, it will always response with that code.

Why is the client doing this? Is it a bug in PuTTY - not flushing the output stream? Is initialising a Telnet communication a 2 part process? How can I handle this?

Thanks in advance.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

I'm uncomfortable with you using character streams for binary data such as 255 251 36 since character conversion issues may mean you are not actually sending what you think you are. I would expect you to be using byte streams.

P.S. Do you really think that a well tested and universally used product like Putty is likely to have such a fundamental bug?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Initialising the Telnet options with the client