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 EF95AD0AD for ; Thu, 11 Oct 2012 12:14:11 +0000 (UTC) Received: (qmail 1860 invoked by uid 500); 11 Oct 2012 12:14:10 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 1452 invoked by uid 500); 11 Oct 2012 12:14:05 -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 1416 invoked by uid 99); 11 Oct 2012 12:14:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2012 12:14:04 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dhoffer6@gmail.com designates 74.125.83.43 as permitted sender) Received: from [74.125.83.43] (HELO mail-ee0-f43.google.com) (74.125.83.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2012 12:13:57 +0000 Received: by mail-ee0-f43.google.com with SMTP id c13so1107411eek.30 for ; Thu, 11 Oct 2012 05:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7Sp5/AWpep/7ufVB210+Pen1J6CA8j3aRbi4M/NS/aM=; b=k0vUwgPZwEro3KGrVSVB0i15753kcRiDNrKX7XwTWjFdgkaTwLfwOLXbaVilOd4AX+ aJFnWzCrk7sYTrJHIl8p+Ub/7sxrW1KiCQ3rQ8B39KTaVmBfyik4zDx9l5KwwdlKC7wA GhabuqoNDQAsY8EB2Tz65ZvUREavCvpSM26WaiTzwObOHVcE7K1LFKZDcKSA0o9vZl1a vUx9i9Zwbuq9zcz1IL8nNEZsK53YUUk3xp+iNRciLuad6JmTlZN/lhaOIpA2TTWB13Vb o/ANmf4freGn/MaVeocTZCRtMk9LfTixcLawqOgwYDLzZTAtV7hzfDUTBuLyHwWUvcdL iYQA== MIME-Version: 1.0 Received: by 10.14.223.4 with SMTP id u4mr1133346eep.19.1349957616387; Thu, 11 Oct 2012 05:13:36 -0700 (PDT) Received: by 10.14.119.131 with HTTP; Thu, 11 Oct 2012 05:13:36 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Oct 2012 06:13:36 -0600 Message-ID: Subject: Re: commons-net sending FTP not working on EC2 server From: David Hoffer To: Commons Users List Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the reply and info. How do I set it in Active mode? I don't see a method to do this. I do see these: setActiveExternalIPAddress() setActivePortRange() But those seem to imply they are used if already in active mode...not clear how to do that. I have added the ProtocolCommandListener I'll see what it report. Does anyone know what ports must be open for this to work? -Dave On Thu, Oct 11, 2012 at 2:29 AM, sebb wrote: > On 11 October 2012 04:27, David Hoffer wrote: >> I just moved an app over to an EC2 server and I'm having trouble >> sending data via FTP. This has worked for years on a different Linux >> server, the new one is Linux too just on Amazon EC2. >> >> The code is really simple...basically... >> >> FTPClient ftp = new FTPClient(); >> ftp.login(username, password); >> ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(fileBytes); >> OutputStream os = ftp.storeFileStream(fileName); >> >> byte buf[] = new byte[8192]; >> int bytesRead = byteArrayInputStream.read(buf); >> while (bytesRead != -1) { >> os.write(buf, 0, bytesRead); >> bytesRead = byteArrayInputStream.read(buf); >> } >> byteArrayInputStream.close(); >> os.close(); >> ftp.completePendingCommand(); >> ftp.logout(); >> >> when I debug it...it blocks forever at the call to storeFileStream(). >> When it runs while not debugging I get a SocketException (Connection >> time out)...not sure if at same line or another such as os.write().. >> >> I was using version 3.0.1, I just upgraded to 3.1 to see if that would >> help but it has the same problem. The only difference I can think of >> is that the old server was using Java 6 the new one is Java 7. One >> other thing that is different is that the EC2 has most ports blocked, >> I've opened port 21 and UDP/DNS. Is there any other ports that are >> needed for FTP? >> >> What might be causing this? I'm completely stuck not knowing where to >> look at this point. > > Most likely there is a port that is not open. > > Try using active FTP mode; that may work better, or may cause issues > if there is a dumb NAT box in the way. > > Try adding a protocol command listener: > > ftp.addProtocolCommandListener(new PrintCommandListener(new > PrintWriter(System.out), true)); > >> -Dave >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >> For additional commands, e-mail: user-help@commons.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org