Java Telnet Client Problem
807580Jul 8 2010 — edited Jul 9 2010Hello- 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