Solved

AxInetCtlsObjects.AxInet GetChunk Size Error

Posted on 2008-10-24
4
1,498 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Winform Module - What is the ASP.Net equiv 2 28
VB.Net - String Manipulation Scenario 2 26
ASP.NET (VB) return a record 2 40
Groupbox Control ? 2 19
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

830 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