🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2139

spawning a telnet session

#2139
From: George Francis
Date: Wed, 30 May 2001 09:35
37 lines
2274 bytes
Hello,
I'm having difficulty spawning a telnet session from my java app.
So far I have the following code:

Runtime aRuntime = Runtime.getRuntime();

        String host = "127.0.0.1";
        int port = 21;
        try
        {
            Process p = aRuntime.exec("telnet.exe " + host + " " + port);
            InputStream pin = p.getInputStream();
            InputStreamReader cin = new InputStreamReader(pin);
            BufferedReader in = new BufferedReader(cin);

            OutputStream pout = p.getOutputStream();
            OutputStreamWriter cout = new OutputStreamWriter(pout);
            BufferedWriter out = new BufferedWriter(cout);
            BufferedWriter out1 = new BufferedWriter(new
OutputStreamWriter(System.out));

            String load = in.readLine();
            System.out.println(load);
            System.setOut(new PrintStream(pout));
            in.close();

        }
        catch(java.io.IOException e)
        {
            e.printStackTrace();
        }

As you can probably see, Im not 100% sure what I'm doing.  Can someone tell
me how to modify this to get the telnet session in either the same dos box
as the vm or a new one?
Thanks for any help.
George.
Technical Details
Message-ID: <3b14bf07$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-fra1.dfn.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!nntp.CS.Uni-Magdeburg.De!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,bf69eaa36dcd1508,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-05-30 02:42:07 PST
Reply-To: "George Francis" <george.francis@ascom.co.uk>
From: "George Francis" <george.francis@ascom.co.uk>
Newsgroups: borland.public.jbuilder.java.api
Subject: spawning a telnet session
Date: Wed, 30 May 2001 10:35:10 +0100
Lines: 39
Organization: Ascom U.K.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 193.243.238.245
Message-ID: <3b14bf07$1_2@dnews>
X-Trace: dnews 991215367 193.243.238.245 (30 May 2001 02:36:07 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-fra1.dfn.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!nntp.CS.Uni-Magdeburg.De!PeerFeed.KWeb.on.ca!dnews