Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2005, 03:29 PM
Authorized User
 
Join Date: Feb 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Sandz
Default Creating a non-interactive telnet session

Hi everyone,

I want to non-interactively telnet onto a Unix server from a windows machine, do something there, and then log-out...all non-interactively. Lets say something like Expect from one Unix server to another. I tried Java networking classes...didint help and then Perl. Not much help either.

Does anyone have any clue?


sands
__________________
Sandz
 
Old February 8th, 2005, 05:27 PM
Authorized User
 
Join Date: Nov 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sonicDace Send a message via MSN to sonicDace Send a message via Yahoo to sonicDace
Default

Sands,

When you telnet onto a server, you are basically establishing a socket connection on port 23.

Try using the Socket class:

http://java.sun.com/j2se/1.5.0/docs/...et/Socket.html

Hope this helps.

Cheers
 
Old February 28th, 2005, 10:01 AM
Authorized User
 
Join Date: Feb 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Sandz
Default

Well the problem is doing this would help me to create a telnet session , but that wouldnt be automatic...in other words i would still have to enter the login and password via the keyboard. I want this to happen non-interactively ; just as it happens when we employ expect scripts in Unix.

Sandz
 
Old March 16th, 2005, 10:48 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Sorry, I know this is OT in a java section, but it's easy to do this in perl

#/usr/bin/perl

use Net::Telnet; # you will need this installed, available from cpan.org, or your distro

$telnet = new Net::Telnet ( Timeout=>10,
                            Errmode=>'die'
                            Prompt => '/\$ $/i');
$telnet->open('remote.site.com');
$telnet->login('user', 'passwd');
print $telnet->cmd('something_or_other');

HTH,

Charlie


--
Don't Stand on your head - you'll get footprints in your hair. http://www.charlieharvey.org.uk
 
Old March 16th, 2005, 10:52 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

oops, you may want to read:
http://search.cpan.org/dist/Net-Teln.../Net/Telnet.pm

as well

--
Don't Stand on your head - you'll get footprints in your hair. http://www.charlieharvey.org.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
java interactive look ruzdi Pro Java 1 February 7th, 2009 06:45 PM
Interactive sort in hidden tables golliaph Reporting Services 0 August 18th, 2008 06:21 AM
How to make interactive voice system gaurav_jain2403 ASP.NET 2.0 Professional 0 August 13th, 2007 12:36 PM
Interactive sort rejoin2me ASP.NET 2.0 Basics 0 July 3rd, 2007 08:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.