Telnet in java - username/login problem
2 posts in topic
Flat View  Flat View

Posted By:   Alfred_Wong
Posted On:   Friday, January 24, 2003 11:31 AM


I've been searching the net for a while trying to figure out how to implement a telnet java application so that I can login into a Unix server and do some stuff. But unfortunately I haven't had much luck. I've found an API provided by Jakarta which has a telnet class and it works it connects to my unix server but doesn't prompt me with a login prompt. At first I figure it to be that maybe it takes a while so i put a sleep on the thread but that didn't work either. So if anybody could help me out here on this small part that would be great.



Re: Telnet in java - username/login problem

Posted By:   Stephen_Ostermiller  
Posted On:   Tuesday, January 28, 2003 03:28 PM

Telnet should be one of the easiest things to implement. You should open a socket to server on port 23. Get the InputStream from the socket connection and echo anything that you read from it to the screen. Capture all key strokes and send them to the OutputStream associated with the socket.

The hard part comes when you get display codes and you have to emulate some terminal's behavior. However, for basic stuff you don't need to do this, only if you run programs like lynx or pine.

Re: Telnet in java - username/login problem

Posted By:   Roger_Hand  
Posted On:   Tuesday, January 28, 2003 04:12 AM

I've had great luck using the Java Telnet/SSH Applet which, despite its name, doesn't need to run in an applet and runs just fine on a server.

Good luck!

About | Sitemap | Contact