| Author |
Java app. sends "CTRL+D" through output stream in linux os.
|
Rakesh Kumar
Ranch Hand
Joined: May 30, 2006
Posts: 63
|
|
Hi dear all,
I ahve a java application which will execute linux commands through java code.But I have to send "CTRL+D" key to close one session in linux.My doubt is how we can hard code and send this CTRL+D code using java code?What is teh string for that ?
rakesh
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16686
|
|
Rakesh Kumar wrote:Hi dear all,
I ahve a java application which will execute linux commands through java code.But I have to send "CTRL+D" key to close one session in linux.My doubt is how we can hard code and send this CTRL+D code using java code?What is teh string for that ?
A control-D is a character with an ASCII value of 4.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Rakesh Kumar
Ranch Hand
Joined: May 30, 2006
Posts: 63
|
|
Dear friend , I have api to send linux connad in my java application as below
telnet.transpose("ls -lrt");
_response = telnet.expect(promptArr);
telnet.transpose("Ctrl+d");------------------------------------->?
_response = telnet.expect(promptArr);
'transpose ' methode we have to pass the linux command , then it will execute it.But my problem is whta is teh string for 'CTRL+D' to pass as i made red color.
Please help
Rakesh
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16686
|
|
Do you know how to create a character with the value of 4? Do you know how to append that character to your string?
try...
Henry
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Rakesh Kumar wrote:urgent help required
Please EaseUp
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Java app. sends "CTRL+D" through output stream in linux os.
|
|
|