Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to be able to set the terminal-speed option explicitly in a native Linux GNU telnet client.

Some context to my problem:

I'm unable to login to an HPUX host using telnet when the telnet process is created by a Java program.

When I telnet to the HPUX host from the command line (from bash), I am able to login and use the session.

When I spawn the telnet process from Java, something strange happens. I am prompted for the username and submit it. I also get the prompt for the password. But for some reason the telnet server does not wait for the password; it quits the session before it is sent.

Looking at the exchange in wireshark, I see that as soon as the telnet client sends an ACK for the password prompt, the server sends a FIN packet, terminating the initializing session.

One of the differences I can see in the handshaking leading up to the password prompt is that the server asks for the terminal speed. When running telnet from the command line, the terminal speed it sends is 38400,38400. When running telnet from Java, the terminal speed is 0,0.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

I'm guessing the telnet client needs a terminal to be able to quote a terminal speed, and I'm guessing that when it's started from Java, there is no tty associated with the process. Depending on your use case, you could try spawning an xterm and running telnet inside that.

If that isn't acceptable, and you can't find a way to set this explicitly using the GNU telnet client, you may want to try using a native Java telnet API mentioned by another poster instead of spawning an external process.

share|improve this answer
    
I think that there being no tty when called from java is the underlying cause. Thanks for your answer! The simplest workaround I've found is to have telnet spawned from 'expect' which seems to supply everything the telnet client needs. –  David Resnick Jul 2 '09 at 8:05

You'll need to give more info about the java telnet client. It sounds like it's it's own client which is the key to figuring out how to make that setting change

share|improve this answer
    
The telnet client is a native Linux one. When I call it from the command line it work; when I call it from Java it doesn't. –  David Resnick Jul 1 '09 at 13:34

Sounds like you want a terminal emulation program (like hyperterm in Windows) instead of a telnet client. Maybe Java Hyper Terminal is what you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.