• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Java app. sends "CTRL+D" through output stream in linux os.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 22684
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:urgent help required


Please EaseUp
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic