Hi there,
I am trying to write a small application to handle a telnet session on a old cisco device, login, issue commands, write responses to log file. I've done this quite easily in perl, but intend to expand the program quite a bit and am much more comfortable with java so am trying to port it. I don't want to use third party libraries(jscape, apache, etc...)
However, I am not getting the response Im expecting from the server, where I should be getting a login prompt I'm getting:
and if I change readLine to read��������65533
The basic method is:
Socket socket = new Socket("My_Devices_IP", 23); socket.setKeepAlive(true); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); out.write("admin\r\n"); System.out.println(in.readLine()); socket.close();
I must be missing something! Any suggestions welcome.