Link to home
Start Free TrialLog in
Avatar of k9k9kk9
k9k9kk9

asked on

AxInetCtlsObjects.AxInet GetChunk Size Error

A couple of years ago I converted a VB6 program to VB.NET. The original used the INET control which in VB.NET became an AxInetCtlsObjects.AxInet object.

The following code executes the SIZE test.txt command and assigns the returned value to MySize.

Dim aInet As AxInetCtlsObjects.AxInet  
Dim MySize as Long  
&&   
aInet.Execute(aInet.URL, SIZE test.txt, "", "")  
MySize = CLng(Trim(aInet.GetChunk(32)))  

If the actual file size of test.txt is less then 4294967296 bytes [=2(32)], MySize gets the correct value. If the file is larger than that, mysize keeps getting 4294967295.

However, when I logon to our FTP site and execute SIZE text.txt command from command prompt directly, it has no problem.

Is this a bug in AxInetCtlsObjects.AxInet or something I missing.

Thanks.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

It sounds like you can upgrade to using native VB.NET classes, but I would like to understand better what you are trying to do?  Are you working with FTP (that would be an FtpWebRequest.

What version of VB.NET are you using?
Avatar of k9k9kk9
k9k9kk9

ASKER

Thank you for taking my question.
 
I didnt use FtpWebRequest. The application was originally written in VB6 and was upgraded to VB.NET. It is a Windows Form app handles file transfer/FTP.  We use  AxInetCtlsObjects.AxInet to execute FTP command and GetChunk command to get results.
 
 
The app involves the following steps:
 
1.      Define the AxInetCtlsObjects.AxInet  object aInet.
Dim aInet As AxInetCtlsObjects.AxInet
With aInet
            .URL = "ftp://" & FTPHost
            .UserName = USRName
            .Password = USRPassword
End With
 
2.      Before a file is transferred, the application checks the files size on the FTP server.
 
           Dim FTPSize as long
            aInet.Execute(aInet.URL, Size test.txt, "", "")
            FTPSize = CLng(Trim(aInet.GetChunk(32)))
           
The problem happens here when a file size is greater than 4294967295(about 4GB). The FTPSize returns 4294967295. I have tried to read the results as string, but it didnt make any difference. Looks like the results from AxInet is 4294967295
 
      Dim a as string
      a = aInet.GetChunk(32).tostring()
 
 
However, if the file size is less than 4294967295, FTPSize returns correct number.
 
 
3.      Get file
     
      Get file
    FTPCmd = Get test.txt 
    aInet.Execute(aInet.URL, FTPCmd, "", "")
           
     This part has NO problem. The file can be transferred to destination.
 
4.      After the transfer, the application checks the file size on the destination local workstation.
 
Dim fi As New System.IO.FileInfo(fileName)
FileSizeLocal = fi.Length
 
      This part works fine. FileSizeLocal is always correct.
 
5.      Make sure the two sizes matches.
 
      If (FileSizeLocal = FTPSize)  then
  &..
  End If
 
      Since the FTPSize is incorrect, the If statement returns false for files larger than 4GB.
 

  Thanks.
 
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of k9k9kk9

ASKER

I tried FtpWebResponse. It works. Thanks a lot for your help.