Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Telnet using Java  RSS feed

 
Arpit
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Nik lammar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at my article...
This is a simple telnet server...
web page
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • 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...
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.jscape.com/inetfactory/index.html
 
Mike Finn
Greenhorn
Posts: 6
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • 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...
 
Van Glass
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The relevant RFC's that you will want to read are RFC 854 and RFC 855. Hope that helps.
 
Bart van Kuik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!