Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

commons net 1.4.1 - sendSiteCommand

Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm seeing something strange when I'm using version 1.4.1 of the Apache commons net library.

I'm trying to use the sendSiteCommand so that I can set the extents to NORLSE.

The command kept failing.
I created a JUnit test which has multiple commands and each one is sent to the FTPClient using sendSiteCommand.

All the commands seemed to be failing - but I found that one of them (verbose) would work on some FTP clients, but not others.

Am I running into problems because each FTP server has to be configured in some way to recieve the commands? Are the commands transmitted differently than if I was typing them in interactively?

I was able to establish FTP sessions and successfully type in the commands without any problems. The commands only fail when I do it through the Apache Commons Net library.

I looked through Search Engines and couldn't find anything, and I didn't see anything on the Apache website talking about sendSiteCommand. On JavaRanch I found a comment that said to include python.jar, but that didn't help me out. I had run into a problem in the past that was jar related, but it had to do with the jakarta-oro.jar being required for file parsing when I got the list of files in a directory. I added the jar to my manifest and that fixed the problem. I also saw something about using \r\n after the command and that didn't do anything either.

I am able to sucessfully establish a connection on all instances, even though the command fails. I've been able to make other method calls work correctly - including calls to retrieve files off the server. It's just the sendSiteCommand that is giving me so much grief.

Has *anybody* succesfully used sendSiteCommand?
I can't be the only person trying this.
If you did use it successfully did you have to do anything special?
Were there any special jars that were included?

Thanks in advance for any clues you can throw my way.

Update 8/29/2006

I've found some more information out since this last post.
You can call the parent class' sendCommand method from the FTPClient which sends a command to the FTP server. The only problem is that the NORSLE ( No Extent ) command doesn't appear to be valid. I'd still like to see if I can set that from the program. Worst case I can run the batch file of FTP Commands from a file called by my Java program but if anybody has any clues on what does and does not work with the sendSiteCommand and sendCommand method I'd like to know. I did find some information about the FTP Command list and on a site called Internet Security Systems I found a list of the reply codes to know what was working and what failed when using the FTP sendCommand method. If you are using the Jakarta FTP Client, the FTP getReplyString method is useful to see the results.
[ August 29, 2006: Message edited by: Greg Ostravich ]
ice is for people that are not already cool. Chill with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!