• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime.getRuntime() -- initialize telnet via socket  RSS feed

 
Stoyan Georgiev
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scenario :
client --> server . I want the client to connect to the server via socket and from there to initialize telnet(ftp) to the client again. The server is getting as a input some comands from the client and executing them, as a responce it sending data to the client.

BufferedReader incoming = new BufferedReader (new InputStreamReader(socket.getInputStream()));

String str=null;

while (( str = incoming.readLine())!= null ){

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec((str).toString());
InputStream stdin = proc.getInputStream();
// and deal it the data

so if i want to execute cmd.exe /C dir --everyting is fine and i can see the responce from the client side but when i try for example to execute telnet IPAddress -- there is no responce (on boat sides - client and server)
Probably there is a specific way to deal with proc.getOutputStream(); to show the responce of the server but i can't find it.
Any ideas
 
Mattias Arthursson
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems a little bit awkward. You might want to take a look atJakarta Commons Net in stead. I'm not absolutely sure if it fits your needs, but chances are good that it does.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!