FoxPro Programming
FTP File uploading Error No. 12030
Gravatar is a globally recognized avatar based on your email address. FTP File uploading Error No. 12030
  RAMESH K IYER
  All
  Feb 20, 2006 @ 12:10am
hi,

I am using West Wind FTP class (wwIPStuff) to uploading/downloading files from local to FTP Server.

As a test case, I uploaded 16 MB file called (Ptrack.zip) into FTP Server through the following FTP COmmand FTPSendFIleEx(). While uploading, if i disconnect the FTP Server, system showing the FTP Error Message "The Connection with the Server was terminated abnormally - 12030.". After getting this error message, I closed the FTP Connection and reopen once again and try to upload the same file. WHile doing this system showing the error message "Source file doesn't exist or is in use..".

The above error, raising at the time of Fopen(filename) Under wwFtp.ftpSendFileEx().

How to close the source file properly and repeat the uploading process. Please send me the Solution to act_ramesh@yahoo.com

Tnk.
Rki

Gravatar is a globally recognized avatar based on your email address. Re: FTP File uploading Error No. 12030
  Rick Strahl
  RAMESH K IYER
  Feb 20, 2006 @ 02:46am
Hi Ramesh,

FtpClose() should close the connection and release the file, unless there was a problem with the upload in which case WinInet may hang on to the file handle for some time.

Just for kicks I just tried this myself here by starting an upload and pulling the network connection. I get the the same error, but the file properly releases as long as FTPClose() is called and I can send again right away.

If you're worried about this scenario, you can copy the file to a different location and giving it a unique filename before sending it up to the server. Then delete it when your done. In the rare case when there is a problem you end up having an open file that eventually releases from WinInet.

+++ Rick ---

I am using West Wind FTP class (wwIPStuff) to uploading/downloading files from local to FTP Server.

As a test case, I uploaded 16 MB file called (Ptrack.zip) into FTP Server through the following FTP COmmand FTPSendFIleEx(). While uploading, if i disconnect the FTP Server, system showing the FTP Error Message "The Connection with the Server was terminated abnormally - 12030.". After getting this error message, I closed the FTP Connection and reopen once again and try to upload the same file. WHile doing this system showing the error message "Source file doesn't exist or is in use..".

The above error, raising at the time of Fopen(filename) Under wwFtp.ftpSendFileEx().

How to close the source file properly and repeat the uploading process. Please send me the Solution to act_ramesh@yahoo.com

Tnk.
Rki




Rick Strahl
West Wind Technologies

Where do you want to surf today?

from Los Angeles, California
Gravatar is a globally recognized avatar based on your email address. Re: FTP File uploading Error No. 12030
  Roenigk
  Rick Strahl
  Oct 7, 2006 @ 10:34am
Rick,

I've run into this same problem and also traced it to ftpsendfileex. Even after FTPClose() is called, the file being uploaded is not released.

Within ftpsendfilex, this line of code locks the file.

lhFile = FOPEN(TRIM(lcSourceFile))

After the failure, the memvar lhFile is released, but the file is still locked. My logs show the file remains locks for more than 24 hours, so there isn't any timeout in play.

Closing the file before releasing the handle solved the problem.

*** And write out each chunk
lnSize=LEN(lcWriteBuffer)
lnBytesRead = 0
lnRetval=InternetWriteFile(hFTPFile,;
lcWriteBuffer,;
lnSize,;
@lnBytesRead)

IF (lnRetVal = 0)
THIS.nError = GetLastError()
THIS.cErrorMsg = THIS.GetSystemErrorMsg()

<b> * Unlock the file before exiting. Bob 10/6/2006
FCLOSE(lhFile)
</b>
RETURN THIS.nError
ENDIF


Hi Ramesh,

FtpClose() should close the connection and release the file, unless there was a problem with the upload in which case WinInet may hang on to the file handle for some time.

Just for kicks I just tried this myself here by starting an upload and pulling the network connection. I get the the same error, but the file properly releases as long as FTPClose() is called and I can send again right away.

If you're worried about this scenario, you can copy the file to a different location and giving it a unique filename before sending it up to the server. Then delete it when your done. In the rare case when there is a problem you end up having an open file that eventually releases from WinInet.

+++ Rick ---

I am using West Wind FTP class (wwIPStuff) to uploading/downloading files from local to FTP Server.

As a test case, I uploaded 16 MB file called (Ptrack.zip) into FTP Server through the following FTP COmmand FTPSendFIleEx(). While uploading, if i disconnect the FTP Server, system showing the FTP Error Message "The Connection with the Server was terminated abnormally - 12030.". After getting this error message, I closed the FTP Connection and reopen once again and try to upload the same file. WHile doing this system showing the error message "Source file doesn't exist or is in use..".

The above error, raising at the time of Fopen(filename) Under wwFtp.ftpSendFileEx().

How to close the source file properly and repeat the uploading process. Please send me the Solution to act_ramesh@yahoo.com

Tnk.
Rki

Gravatar is a globally recognized avatar based on your email address. Re: FTP File uploading Error No. 12030
  Rick Strahl
  Roenigk
  Oct 7, 2006 @ 03:45pm

Good catch!!! Thanks, that's fixed. The change is slightly different - I exit to ensure that hte Internethandle gets closed to and then return the this.nError as the RETURN value.

+++ Rick ---

Rick,

I've run into this same problem and also traced it to ftpsendfileex. Even after FTPClose() is called, the file being uploaded is not released.

Within ftpsendfilex, this line of code locks the file.

lhFile = FOPEN(TRIM(lcSourceFile))

After the failure, the memvar lhFile is released, but the file is still locked. My logs show the file remains locks for more than 24 hours, so there isn't any timeout in play.

Closing the file before releasing the handle solved the problem.

*** And write out each chunk
lnSize=LEN(lcWriteBuffer)
lnBytesRead = 0
lnRetval=InternetWriteFile(hFTPFile,;
lcWriteBuffer,;
lnSize,;
@lnBytesRead)

IF (lnRetVal = 0)
THIS.nError = GetLastError()
THIS.cErrorMsg = THIS.GetSystemErrorMsg()

<b> * Unlock the file before exiting. Bob 10/6/2006
FCLOSE(lhFile)
</b>
RETURN THIS.nError
ENDIF


Hi Ramesh,

FtpClose() should close the connection and release the file, unless there was a problem with the upload in which case WinInet may hang on to the file handle for some time.

Just for kicks I just tried this myself here by starting an upload and pulling the network connection. I get the the same error, but the file properly releases as long as FTPClose() is called and I can send again right away.

If you're worried about this scenario, you can copy the file to a different location and giving it a unique filename before sending it up to the server. Then delete it when your done. In the rare case when there is a problem you end up having an open file that eventually releases from WinInet.

+++ Rick ---

I am using West Wind FTP class (wwIPStuff) to uploading/downloading files from local to FTP Server.

As a test case, I uploaded 16 MB file called (Ptrack.zip) into FTP Server through the following FTP COmmand FTPSendFIleEx(). While uploading, if i disconnect the FTP Server, system showing the FTP Error Message "The Connection with the Server was terminated abnormally - 12030.". After getting this error message, I closed the FTP Connection and reopen once again and try to upload the same file. WHile doing this system showing the error message "Source file doesn't exist or is in use..".

The above error, raising at the time of Fopen(filename) Under wwFtp.ftpSendFileEx().

How to close the source file properly and repeat the uploading process. Please send me the Solution to act_ramesh@yahoo.com

Tnk.
Rki





Rick Strahl
West Wind Technologies

Where do you want to surf today?
Reader Version: 5.0

From Maui, Hawaii
© 1996-2016