Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B4B577865 for ; Wed, 12 Oct 2011 16:00:54 +0000 (UTC) Received: (qmail 86632 invoked by uid 500); 12 Oct 2011 16:00:53 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 86532 invoked by uid 500); 12 Oct 2011 16:00:53 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 86524 invoked by uid 99); 12 Oct 2011 16:00:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2011 16:00:53 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [98.139.91.94] (HELO nm24.bullet.mail.sp2.yahoo.com) (98.139.91.94) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 12 Oct 2011 16:00:44 +0000 Received: from [98.139.91.63] by nm24.bullet.mail.sp2.yahoo.com with NNFMP; 12 Oct 2011 16:00:22 -0000 Received: from [98.139.91.49] by tm3.bullet.mail.sp2.yahoo.com with NNFMP; 12 Oct 2011 16:00:22 -0000 Received: from [127.0.0.1] by omp1049.mail.sp2.yahoo.com with NNFMP; 12 Oct 2011 16:00:22 -0000 X-Yahoo-Newman-Id: 604004.74363.bm@omp1049.mail.sp2.yahoo.com Received: (qmail 22939 invoked from network); 12 Oct 2011 16:00:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1318435222; bh=IKEjeCzy+ujxunz8EMriVAA4es8B0EjObNZG2nfs4D4=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:In-Reply-To:Mime-Version:Content-Type:Message-Id:Content-Transfer-Encoding:Cc:From:Subject:Date:To:X-Mailer; b=yXK2dle9ZKOeC0sFl4tCCU5v311HHzu/qhgQVQmAowuglxpqy/2pRrXsZw7vk3l7oxfODW5lu8hOxQQT238cehv8C2ria9vpk+swyYk76pUu2dL0H5V5YRx1kDh1Kf71qPj8r0LlnJP7LquTVDnKxNm3q6yFl6Y7eqPOwY/bZXQ= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: IYg5A5cVM1lvC1E2ffvFW.jKkKqX2B3jmOqxPl6SbpLNUKV LIdXsCgIDD4l924bewmlfnpn9lRrPeZjGopr4C9Evqg7FeEtKPekqJDXQR4u Tkvxqq.AU8wZkL6cL4qKT4hUSes_EtLnUAyrjd7HQhv2EJ6iQjyxJHhBo2ka 5tIZWc28cGKro.458YhKr4iSl8Eg3CObkasmWk87xpYxWIPzKjlk6buJ9paU Cke3ydIo1o8OSyMapTNnWVW4SlAouHytK9PG.ippRupl._DU.4cCbkf6sXA3 Jr8LCNhQFs2M1bieScE_JyHL76Q11mgGH2ihaVKqsWxvmwlTb4Kmf85JI.bI UfC22M1KkDRTM7feWqfAQJNzlHCLEWSN3g.5f3pQWZWKML6t5gc9tMQ7uw2N 8Jd_9G34PRJM7emUVspmrfiPDjohw.LZY X-Yahoo-SMTP: yR2SxyeswBBZtzlgPBfdKkvAwJ0oxw-- Received: from [10.116.102.12] (Daniel@166.205.139.25 with plain) by smtp112.biz.mail.sp1.yahoo.com with SMTP; 12 Oct 2011 09:00:20 -0700 PDT References: In-Reply-To: Mime-Version: 1.0 (iPhone Mail 8L1) Content-Type: text/plain; charset=us-ascii Message-Id: <989161D4-93DA-49D6-9085-99E2598ACDDF@coloraura.com> Content-Transfer-Encoding: quoted-printable Cc: "user@commons.apache.org" From: Daniel Pitts Subject: Re: Telnet: Problems automating a session Date: Wed, 12 Oct 2011 08:29:05 -0700 To: Commons Users List X-Mailer: iPhone Mail (8L1) X-Virus-Checked: Checked by ClamAV on apache.org Try calling outputStream.flush() after each command.=20 Thanks, Daniel. Sent from my iPhone On Oct 12, 2011, at 8:23 AM, Jason Dorsey wrote: > Hey, >=20 > Very new to java socket programming and I am having an issue with automati= ng a session to issue one command and then exit. When I use the commons teln= et library I am able to connect and successfully run the command, but only w= hen I interact with the prompt. When I try and simulate just issuing the com= mands it does not work. What seems to be happening is that instead of writin= g each command as a separate packet, all the commands are being sent in the s= ame packet (validated this with wireshark). >=20 > What I have checked. >=20 >=20 > 1. The batch file does work locally on the system. >=20 > 2. The command does work when typed into a telnet session (validated= with tcpview). >=20 > 3. The non-working version does connect to the remote system. >=20 > 4. The correct auth information is being passed to the function call= . >=20 > Setup that works: >=20 >=20 > Just like the weather demo >=20 > My faulty setup: >=20 > Append the user, pass, command and exit strings with "\r\n". (user +=3D "\= r\n";) > And with each item I: > Convert them into a ByteArrayInputStream (in =3D new ByteAr= rayInputStream(user.getBytes());) > Invoke Util.copyStream (Util.copyStream(in, remoteOutput); )= // where remoteOutput is the telnet's outputstream >=20 > Thanks >=20 > Jason Dorsey | Engineering Intern >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org