0

Socket Programming

asked 2009-12-04 22:03:55 +0800

ibsolution gravatar image ibsolution
468 1 1 6

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

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2009-12-05 17:48:32 +0800

YamilBracho gravatar image YamilBracho
1722 2

Andy, this operation is completely left to the telnet library you are using...

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-12-04 22:03:55 +0800

Seen: 468 times

Last updated: Dec 05 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More