Conexion a un Servidor Remoto HELP!!!!!
Buenas Tardes,
Consegui un buen ejemplo en donde se simula el comando de Rlogin de unix en una clase java, par establecer una conexion, solo que no estaban todas las clases que ahi se usan.
/*
* @(#)RloginExample.java
*
* Copyright (c) 2001-2002 JScape
* 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* JScape. ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with
* the terms of the license agreement you entered into with JScape.
*/
import java.io.*;
import com.jscape.inet.bsd.*;
import java.util.Vector;
public class RloginExample {
public static void login(String hostname, String username, String terminal) {
Vector list = new Vector();
// create new Rlogin instance
Rlogin rlogin = new Rlogin(hostname, username, username, terminal);
try {
// establish connection
rlogin.connect();
// execute command
rlogin.execute();
// stream output to console
OutputReader reader = new OutputReader(rlogin.getInputStream(), System.out,list);
// read input from console
InputWriter writer = new InputWriter(System.in, rlogin.getOutputStream(),list);
// start input and output threads
reader.setPriority(Thread.currentThread().getPriority() + 1);
reader.start();
writer.setDaemon(true);
writer.start();
try {
reader.join();
writer.interrupt();
}
catch(InterruptedException e) {
e.printStackTrace();
}
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String hostname;
String username;
String terminal;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Rlogin hostname (e.g. domain.com): ");
hostname = reader.readLine();
System.out.print("Enter Rlogin username: ");
username = reader.readLine();
System.out.print("Enter terminal type (enter for dumb terminal): ");
terminal = reader.readLine();
RloginExample example = new RloginExample();
example.login(hostname,username,terminal);
}
catch(Exception e) {
System.exit(1);
e.printStackTrace();
}
}
}
me gustaria saber quien me pued ayudar, quien me puede dar una bendita idea de como establecer la conexion al servidor remoto ya jamas he trabajado con esto y me lo estan exigiendo en mi trabajo.
Atte
Elena Ramirez
Consegui un buen ejemplo en donde se simula el comando de Rlogin de unix en una clase java, par establecer una conexion, solo que no estaban todas las clases que ahi se usan.
/*
* @(#)RloginExample.java
*
* Copyright (c) 2001-2002 JScape
* 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* JScape. ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with
* the terms of the license agreement you entered into with JScape.
*/
import java.io.*;
import com.jscape.inet.bsd.*;
import java.util.Vector;
public class RloginExample {
public static void login(String hostname, String username, String terminal) {
Vector list = new Vector();
// create new Rlogin instance
Rlogin rlogin = new Rlogin(hostname, username, username, terminal);
try {
// establish connection
rlogin.connect();
// execute command
rlogin.execute();
// stream output to console
OutputReader reader = new OutputReader(rlogin.getInputStream(), System.out,list);
// read input from console
InputWriter writer = new InputWriter(System.in, rlogin.getOutputStream(),list);
// start input and output threads
reader.setPriority(Thread.currentThread().getPriority() + 1);
reader.start();
writer.setDaemon(true);
writer.start();
try {
reader.join();
writer.interrupt();
}
catch(InterruptedException e) {
e.printStackTrace();
}
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String hostname;
String username;
String terminal;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Rlogin hostname (e.g. domain.com): ");
hostname = reader.readLine();
System.out.print("Enter Rlogin username: ");
username = reader.readLine();
System.out.print("Enter terminal type (enter for dumb terminal): ");
terminal = reader.readLine();
RloginExample example = new RloginExample();
example.login(hostname,username,terminal);
}
catch(Exception e) {
System.exit(1);
e.printStackTrace();
}
}
}
me gustaria saber quien me pued ayudar, quien me puede dar una bendita idea de como establecer la conexion al servidor remoto ya jamas he trabajado con esto y me lo estan exigiendo en mi trabajo.
Atte
Elena Ramirez