Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 02-16-2005, 09:20 PM   #1 (permalink)
Crazy
 
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  
Old 02-16-2005, 11:03 PM   #2 (permalink)
a-j
Tilted
 
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-16-2005 at 11:06 PM..
a-j is offline  
Old 02-17-2005, 07:47 AM   #3 (permalink)
I am Winter Born
 
Pragma's Avatar
 
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  
 

Tags
java, telnet


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



All times are GMT -8. The time now is 02:27 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73