Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Telnet Client Problem

807580Jul 8 2010 — edited Jul 9 2010
Hello- can anyone help ? I'm new to this network, so apologies if my post is in the wrong place, or not properly formatted..

I'm trying to write an application that will telnet to a machine (eg. a cisco router), and allow me to send commands, anticipate responses, and record output to a text file.

I've written the basics using the Apache commons library, Commons Net - Jakarta Commons Net which allows me to set up a connection along the following lines :

//set up inputstream and outputstream etc

public void sendCR(String value)
{
try {
value += "\r\n";
out.print(value);
out.flush();
System.out.println(value);
}
catch (Exception e)
{
e.printStackTrace();
}
}

This actually works fine when connecting to something like a cisco router or switch, and allows me to login in and send commands and get responses etc, no problem.

The problem I'm having is when telnetting to a Dialogic VoiceGateway - It won't seem to accept my carriage returns - I've tried all sorts of combinations, and it will accept a string, but I can't seem to send an ENTER to accept it. It just sits there, and eventually times out.

I'm pretty sure it's not a problem with the machine I'm connecting to, as I can access it fine using a Telnet client like putty (or just the windows one) so I'm thinking there must be a setting i need my client to be able to negotiate or something.

I don't really expect anyone to be able to advise specifically on the Dialogic box(although if you can, great!), but I'm wondering if anyone's experienced anything similar, or if I'm overlooking something - I'm fairly new to development, but this seems like it should be pretty simple- I can supply further code if necessary..

Thanks in advance!

Read more: Java Telnet Client problem
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2010
Added on Jul 8 2010
4 comments
1,852 views