Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting Active mode FTP file send

Status
Not open for further replies.

Skreemer

Technical User
Nov 9, 2005
8
US
Using procomm version 4.5.
I'm attempting to send a file via FTP in active mode. I believe I have all the defaults set correctly I can send the file manually with a drag and drop. When I use the script to send the file I get:
**********************************
TYPE I
200 Type set to I.
[644] going to listen 0.0.0.0 port 2303
PORT 10,24,160,151,9,0
200 PORT command successful.
[644] listener 0.0.0.0 port 2304
STOR 20051109143923.PGP
150 Opening BINARY mode data connection for /ftp/4ctp/put/20051109143923.PGP.
[644] Socket closed.
[652] accept from 168.183.165.14 port 20
Error opening file - 20051109143923.PGP (13)
[652] Socket closed.
226-File rejected, 0 bytes received .
226 Transfer complete.
quit
[596] Socket closed.
******************************

I'm concerned about the error opening file. The server side folks say all they are getting is a filename and no data.

Here's the portion of the script that run's at that point.

***********************************
FUNC SendFiles:INTEGER
INTEGER lnXmitStatus
STRING lsHostDir
STRING lsInput
STRING lsTemp, lsFile

SET ftp passivemode OFF
IF CJSMODE==0
lsTemp = CJSSFIL[1]
lsHostDir = "/ftp/4ctp/put"
strfmt lsInput "# File %s Was Sent Successfully as Production" CJSSFIL[1]
ELSE
lsTemp = CJSSFIL[1]
lsHostDir = "/ftp/4ctp/put"
strfmt lsInput "# File %s Was Sent Successfully AS TEST!!" CJSSFIL[1]
ENDIF

IF Expect("hello",10,0)
ENDIF

termmsg "We are about to change directories"
termmsg "`r`n"

;*******Local Directory Path Change*************************
FTP LOCAL CHDIR CJSPATH

termmsg "We just changed our local DIR"
termmsg "`r`n"

IF SUCCESS
SendToCJS("STAT","+ Local CHDIR Successful")
ELSE
SendToCJS("STAT","+ Local CHDIR FAILED!!")
RETURN 2
ENDIF

;*******REMOTE directory change******************************
FTP REMOTE CHDIR lsHostDir
termmsg "We just changed their remote DIR"
termmsg "`r`n"

IF SUCCESS
SendToCJS("STAT","+ Remote CHDIR Successful")
PAUSE 1
termmsg "`r`n"
termmsg "CJSSFIL[1] %s" CJSSFIL[1]
termmsg "`r`n"

strright lsFile CJSSFIL[1] 18
SET ftp passivemode OFF
FTP LOCAL copyfile lsFile
IF FAILURE
SendToCJS("STAT","+ Copyfile to remote NOT Successful!!")
RETURN 2
ELSE
SendToCJS("STAT","+ Copyfile to remote Successful")
SendToCJS("STAT",lsInput)
termmsg "`r`n"
termmsg "File sent succesfully"
termmsg "`r`n"
ENDIF
ELSE
SendToCJS("STAT","+ Remote CHDIR FAILED!!")
RETURN 2
ENDIF

IF Expect("hello",10,0)
ENDIF

RETURN 0
ENDFUNC
***********************************

Sorry for the abundance of info, I'd rather have too much than not enough.
 
My initial hunch is that the script is continuing on before the FTP transfer is complete. If you take a look at the samples page on my site (linke below), you'll see a couple scripts for FTP transfers that you can copy into your existing script.

 
I actually found and looked through your page before I even posted here. The file send box appears on the screen. Aside from that I use this exact code for about 12 different connections just changing the host directory. I'm not having this issue with any of the other ones.
 
So the script works fine on other machines, and the same steps manually work OK on the problem system? Are you connecting using a Connection Directory entry? If so, check the settings between the problem site and a site that works and see if you notice any differences.

 
Unfortunately what you see is all I have.
I am using this script to connect to different sites. This is the only one I am having a problem with. According to the IT folks at the site I am connecting to I am having issues because I am not initiating the send in "active mode" and because it's "passie" they refuse the file.

I'd love to be able to look at the server I am connecting too and try to figure out what's different on thier server from the rest I connect to but I'm completely "blind"...
 
Sorry, I wasn't clear in my last response. You don't need to worry about the server settings, but the settings you have for each FTP site in the Connection Directory (if you are connecting in that manner, can't tell from your script).

 
every time it connects it creates an entry called $$TEMP$$.
It's set to [current].
Will this not change if I call for it in the script?
 
A Connection Directory entry called $$TEMP$$ is created each time you make a connection, or a file of that name?

Can you send me your full script (email address can be found at the link below) to look over?

 
script sent. worst case scenario I can be reached on AIM as Skreemer1 or by phone at the number contained in the e-mail.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top