Solved

AxInetCtlsObjects.AxInet GetChunk Size Error

Posted on 2008-10-24
4
1,509 Views
Last Modified: 2013-12-20
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.
0
Comment
Question by:k9k9kk9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 22803142
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?
0
 

Author Comment

by:k9k9kk9
ID: 22812190
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.
 
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 22812349
The COM library doesn't look like it does what you need, so I would suggest taking a different direction.  You might be able to find a solution, by finding some magic, but that is not what I would suggest.  Sometimes, there are just limitations to old technology.  

.NET has a pretty easy way to connect to and work with an FTP server, and that is what I would suggest.  There are plenty of resources available to help you find a way to get what you need.
0
 

Author Comment

by:k9k9kk9
ID: 22814226
I tried FtpWebResponse. It works. Thanks a lot for your help.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question