-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hai,
i would like to connect to remote server using a telnet. how to send a username from a ZK ?
i would like execute this from a button from a grid, this my code
button.addEventListener("onClick", new EventListener() {
public void onEvent(Event event)
{
TelnetClient tc = new TelnetClient();
try {
tc.connect("192.168.52.14", 23);
DataInputStream sinstream = new DataInputStream(tc.getInputStream());
PrintStream soutstream = new PrintStream(tc.getOutputStream());
String data_line = sinstream.readLine();
while (data_line != null)
{
if (data_line.indexOf("login") != -1 )
soutstream.println("administrator");
if (data_line.indexOf("password") != -1 )
soutstream.println("P@ssw0rd");
// display info
System.out.println(data_line);
data_line = sinstream.readLine();
}
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
try {
tc.disconnect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
i am using zk 3.6.3
Regards,
Andy Susanto
Andy, this operation is completely left to the telnet library you are using...
Asked: 2009-12-04 22:03:55 +0800
Seen: 468 times
Last updated: Dec 05 '09