473,321 Members | 1,669 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,321 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 3381
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.