• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Telnet using Java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Can someone tell me how to do telnet in java. I want to execute one command on my unix box using telnet. I have Machine name and userid/pwd with me.
I believe there is not any java API available till yet.

Please help me asap as my deadline is very near.
If any API is available ( open source ) , please let me know.

thanks and regards,
Arpit Jain
SCJP
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arpit, please change your displayed name to conform to our
naming policy. In short, your name must be a first name and last name, separated by a space and not obviously fake.
I am going to move this post to the Sockets and Internet Protocols forum, which is more appropriate for telnet discussion.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at my article...
This is a simple telnet server...
web page
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Arpit:
Can someone tell me how to do telnet in java.....
.....
Please help me asap as my deadline is very near.


It might not be a big deal for an experienced developer to help you coding this kind of simple application. But it won't increase your programming skill, which is one of the reasons that you are on this kind of project.

But I can give you some hints to help you. Just a sketch to see the idea.
-Create Socket to the telnet server that you are connecting to.
-Using OutputStream and InputStream associated with that Socket to communicate with the telnet server. (This might be a handy job.)
-Put your code inside while(true) loop and put a terminating criterion inside that loop also so that your loop won't run forever.

That's it! I hope you get some ideas...

Try to code sthing and ask questions here... It's a good way to learn things...
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.jscape.com/inetfactory/index.html
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://jakarta.apache.org/commons/net/
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by somkiat puisungnoen:
http://www.jscape.com/inetfactory/index.html



Well, the above package is not free and we need to buy the full version, if we want to use it... And it won't be that useful for studying how they work...

But the Jakarta's Commons Net, that Mike said, would be good for studying how those protocols work and using Java to implement them...

Reading the corresponding RFCs and implementing them by ourselves would be a better approach to learn in details of how they work...
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The relevant RFC's that you will want to read are RFC 854 and RFC 855. Hope that helps.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of coding the whole thing, just run an Ant task. See the next example, in which a download from a source repository is done on a Windows box.
 
Bart van Kuik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forgot to mention: if you want to code it your, check out the Apache Commons/Net library. I've used the FTP part and it's excellent.
 
expectation is the root of all heartache - shakespeare. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic