Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-tm-dev] Re: Telnet Help

Sorry i have posted wrong code... this below code is correct code

        IHost host = null;
        try {
            ISystemRegistry sysReg = RSECorePlugin.getDefault()
                    .getSystemRegistry();
            if (sysReg != null) {
                IRSECoreRegistry coreReg = RSECorePlugin.getDefault()
                        .getCoreRegistry();

                if (coreReg != null) {
                    IRSESystemType telnetType = coreReg
                            .getSystemTypeById("org.eclipse.rse.systemtype.telnet");

                    if (telnetType != null) {
                        try {
                            host = sysReg.createHost(telnetType, "test",
                                    "192.168.200.5", "my host");
                        } catch (Exception e1) {
                            e1.printStackTrace();
                        }
                    }
                }
            }

            ISubSystem[] subSystems = host.getSubSystems();
            int i;
            for (i = 0; subSystems != null && i < subSystems.length; i++) {
                if (subSystems[i] instanceof IShellServiceSubSystem)
                    break;
            }

            final ISubSystem subSystem = subSystems[i];
            subSystem.getConnectorService().setUserId("temp");
            subSystem.getConnectorService().setPassword("temp", "temp", false,
                    false);
            subSystem.getConnectorService().saveUserId();
            subSystem.getConnectorService().savePassword();

            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    try {
                        subSystem.connect(true, null);
                    } catch (Exception e) {
                    }
                }
            });

            IHostShell hostShell = null;
            IShellService shellService = ((IShellServiceSubSystem) subSystem)
                    .getShellService();
            String env[] = new String[0];
            if (shellService != null) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                hostShell = shellService.launchShell("", env,
                        new NullProgressMonitor());
            }

On Jan 8, 2008 8:43 PM, hari babu <haribabu2006@xxxxxxxxx> wrote:
Hi,

I have connected to a host......

Regards
Hari


Back to the top