Tilted Forum Project - TFP - Sexuality, Philosophy and Political Discussion

Go Back   Tilted Forum Project - TFP - Sexuality, Philosophy and Political Discussion > Interests > Tilted Technology

Reply
 
LinkBack Thread Tools
Old 02-16-2005, 10:20 PM   #1 (permalink)
Crazy
 
Join Date: Apr 2003
Telnet and Java

yoyo,

I am writing an application in Java that connects to a router via telnet and runs a script of commands and captures the output. A lot of dudes on the web say the telnet protocol is ugly and to use someone else's implementation, which is good, but I can't find a good implementation. All I need is connect, login with stored usernameassword send a string, receive the output. disconnect. sounds simple enough. any help is greatly appreciated.
student is offline   Reply With Quote
Old 02-17-2005, 12:03 AM   #2 (permalink)
a-j
Tilted
 
Join Date: Sep 2004
I would suspect that the router is nothing more than a straight raw TCP/IP connection -- similar to using telnet to connect to a POP or SMTP server or even HTTP. I would first use something like Ethereal to trace the connection and see what data goes back and forth, probably straight ASCII text -- nothing binary. If that is all it is you can simply use java to connect to the system and write some data (send the appropriate command). Then just read data until you receive some "end-of-line" token. Make sure you get the end-of-line characters correct, because some protocols will interpret them differently.

I suspect all you really need is
Socket(InetAddress, port)
Socket.getOutputStream() - for sending the commands
Socket.getInputStream() - for receiving the output

Last edited by a-j; 02-17-2005 at 12:06 AM.
a-j is offline   Reply With Quote
Old 02-17-2005, 08:47 AM   #3 (permalink)
I am Winter Born
 
Pragma's Avatar
 
Join Date: Apr 2003
Location: Alexandria, VA
I agree with a-j: telnet is nothing more than passing pure text messages back and forth (such as "connect 192.168.0.1"). You should easily be able to tell Java to open a socket, dump some text into the socket, wait for the reply, display it, repeat as necessary.
Pragma is offline   Reply With Quote
Reply

Bookmarks

Tags
java, telnet

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -7. The time now is 12:00 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
All text (c) 2002-2008 Tilted Forum Project
"Insignia" vBulletin 3.5 - b6gm6n - x7x7x7.com