473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

a97 - problem transfer file from server with https

Hi NG,

I used the Internet Data Transfer Library of Dev Ashish found at
http://www.mvps.org/access/modules/mdl0037.htm to transfer text files from
a server with HTTPS in my old Ms Access 97 application.

'----snip----
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib.HTTP
Const conTARGET = "https://ip.of.my.server/PathToMyFile/MyFile.csv"

Set objHTTP = New InetTransferLib.HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "c:\MyFile.csv"
If .FileExists Then .OverwriteTarget = True
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

This code was running fine for months - I did not changed anything but for
a couple of days I receive an error 6 - overflow message when
..WriteHTTPDataToFile is in progress.

The file size of MyFile.csv is about 100-250kb...

I tried to use the microsoft internet transfer control activex v6.0 but
with no success... ;-(

Any help or sample code is welcome

Regards

Hanspeter
Jan 6 '06 #1
6 3386
IIRC there is a bug in the INetTransferLib.

In the WriteHTTPDataToFile and the WriteFTPDataToFile ther is a line which
looks like this
Call apiWriteFile(hFile, abytData(0), MAX_CHUNK, _
lngBytesWritten, 0&)
Which should be this
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)


--
Terry Kreft

"Hanspeter Leupin" <le***@csi.com> wrote in message
news:1l*****************************@40tude.net...
Hi NG,

I used the Internet Data Transfer Library of Dev Ashish found at
http://www.mvps.org/access/modules/mdl0037.htm to transfer text files from
a server with HTTPS in my old Ms Access 97 application.

'----snip----
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib.HTTP
Const conTARGET = "https://ip.of.my.server/PathToMyFile/MyFile.csv"

Set objHTTP = New InetTransferLib.HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "c:\MyFile.csv"
If .FileExists Then .OverwriteTarget = True
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

This code was running fine for months - I did not changed anything but for
a couple of days I receive an error 6 - overflow message when
.WriteHTTPDataToFile is in progress.

The file size of MyFile.csv is about 100-250kb...

I tried to use the microsoft internet transfer control activex v6.0 but
with no success... ;-(

Any help or sample code is welcome

Regards

Hanspeter

Jan 6 '06 #2
Red
I love Dev's coding...

But, I would guess that the file being written is to big... but,
honestly, this is just a guess
~Red

Jan 7 '06 #3
Hi Terry,

Thanks for your replay.

On Fri, 6 Jan 2006 16:29:36 -0000, Terry Kreft wrote:
Call apiWriteFile(hFile, abytData(0), MAX_CHUNK, _
lngBytesWritten, 0&)
Which should be this
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)

I replaced MAX_CHUNK with lngBytesRead... well the overflow error is gone -
but the download of the file doesn't work. The code loops for ever at the
line where I did the change. The progress bar doesn't move and the filesize
of my 20kb file stays at 0...

lngTotalBytesWritten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CHUNK)
lngRet = apiInetReadFile(hURL, abytData(0), MAX_CHUNK, lngBytesRead)
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)
lngTotalBytesWritten = lngTotalBytesWritten + lngBytesWritten
Call SysCmd(acSysCmdUpdateMeter, CInt(lngTotalBytesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
Any ideas or is there something missing ?

Hanspeter
Jan 7 '06 #4
On 6 Jan 2006 07:45:41 -0800, Red wrote:
I love Dev's coding...

But, I would guess that the file being written is to big... but,
honestly, this is just a guess
~Red


Hi Red,

well the code was fine till two weeks ago. The filesize was always in the
same range...

Is there no other code to transfer a file from https with a97?

Regards

Hanspeter
Jan 7 '06 #5
OK, there's something else going on.

Firstly don't worry about the file size staying at zero, IIRC the file size
doesn't get written until the download is finished.

I've tested this and it works fine.

The relevant piece of code I have in WriteHTTPDataToFile is :-
lngTotalBytesWritten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CHUNK)
lngRet = apiInetReadFile(hURL, _
abytData(0), _
MAX_CHUNK, _
lngBytesRead)
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)
lngTotalBytesWritten = lngTotalBytesWritten + lngBytesWritten
Call SysCmd(acSysCmdUpdateMeter, CInt(lngTotalBytesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
I'm call ing the routine as follows
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib.HTTP
Const conTARGET = "http://www.mvps.org/access/acknowledge.htm"

Set objHTTP = New InetTransferLib.HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "C:\test.htm"
If .FileExists Then .OverwriteTarget = True
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

and this works. (the file created is 73.5 kb).

In the WriteHTTPDataToFile procedure try keeping a track of
lngBytesRead this should be at most MAX_CHUNK
lngBytesWritten this should be at most lngBytesRead
lngTotalBytesWritten this should be at most the size of your file in
bytes.

--
Terry Kreft

"Hanspeter Leupin" <le***@csi.com> wrote in message
news:rw****************************@40tude.net...
Hi Terry,

Thanks for your replay.

On Fri, 6 Jan 2006 16:29:36 -0000, Terry Kreft wrote:
Call apiWriteFile(hFile, abytData(0), MAX_CHUNK, _
lngBytesWritten, 0&)
Which should be this
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)

I replaced MAX_CHUNK with lngBytesRead... well the overflow error is
gone -
but the download of the file doesn't work. The code loops for ever at the
line where I did the change. The progress bar doesn't move and the
filesize
of my 20kb file stays at 0...

lngTotalBytesWritten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CHUNK)
lngRet = apiInetReadFile(hURL, abytData(0), MAX_CHUNK, lngBytesRead)
Call apiWriteFile(hFile, abytData(0), lngBytesRead, _
lngBytesWritten, 0&)
lngTotalBytesWritten = lngTotalBytesWritten + lngBytesWritten
Call SysCmd(acSysCmdUpdateMeter, CInt(lngTotalBytesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
Any ideas or is there something missing ?

Hanspeter

Jan 7 '06 #6
On Sat, 7 Jan 2006 12:17:29 -0000, Terry Kreft wrote:
OK, there's something else going on.

Firstly don't worry about the file size staying at zero, IIRC the file size
doesn't get written until the download is finished.

I've tested this and it works fine.

Const conTARGET = "http://www.mvps.org/access/acknowledge.htm"

and this works. (the file created is 73.5 kb).


Hi Terry,

I checked all the code and I tried the sample you did and it works fine
too! The download of http://www.mvps.org/access/acknowledge.htm worked...
but when I go back to my https page on the intranet the download breaks and
loops for ever... I reinstalled the certificates...

When ever IE was in the background open to the secure page - access97
successfully downloaded the files...

Well - we can keep on right click the files and store them localy... :-)

Reagrds

Hanspeter
Jan 7 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JT | last post by:
i'm using a model, view, control architecture for a group of .asp pages. i can't decide whether to use Server.Transfer or Server.Execute to pass posted data from my control to my model. are...
1
by: Marwan Abi Khalil via DotNetMonster.com | last post by:
hello, i want to send an XML file over https using POST method (httpwebrequest) if anyone can provide me with some code would be gr8 coz i tried so manything and everytime i get the 500 error...
4
by: Logidec | last post by:
What is better method to transfer file to PocketPC from PC ? Thank
4
by: ewolfman | last post by:
Hi, This may sound a little complicated, but here goes: I have 2 webforms (lets call them 'x' and 'y'). * - 'x' is a form which contains a single server side TextBox web control, and an...
4
by: Mark Olbert | last post by:
I'm looking for help in getting the Transfer Sql Server Objects task to work. The goal is to transfer the tables, views, sprocs, udfs from a SqlServer 2000 database to a Sql Server 2005 database. ...
9
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server...
3
by: gaurav92K | last post by:
sir, please tell me how can we transfer file through netmetting in xp.
8
by: sganeshsvk | last post by:
sir, i want to transfer the file and folders from Linux OS to WindowsXP OS... plz send Linux Command for transfer file and folders from Linux OS to WindowsXP OS ...
0
by: sganeshsvk | last post by:
sir, i want to transfer the file and folders from Linux OS to WindowsXP OS... plz send Linux Command for transfer file and folders from Linux OS to WindowsXP OS ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.