From: Tony Toews [MVP] on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote:

>? I mean that the error on the non-existing file
>seems to indicate the connection was broken.
>Am I misinderstanding? With a successful
>communication (whether there's a file or not)
>the return code (from the RequestFile function)
>should be 0 while the server code should be 200,
>301, 404, etc. I was assuming that you got 200
>in the iErrCode box when you downloaded a file,
>with return code of 0.
>(You can't get anything but 0 or 99+ on the return,
>code, which shows in the upper box marked
>"return code".)

No matter if I download a genuine file or not, from a valid domain
name, I always get
Return Code: 0
Return String File: requested succeeded
Errcode: -1
ErrStr: 10038

Now if I put in mvps.orggg I get
Return Code: 112
Return String: Failed to resolve server IP address.
which is expected.

If I download a non existent file on mvps.org I get in the textbox.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /asdfsadf was not found on this server.</p>
</body></html>

> Have I got that right? Another thought I had: It sounds
>like you're doing GETs, but if you're doing HEAD that might
>make a difference.

Haven't yet touched that code to change it to HEAD (or rather give
that as on option.)

Private Function SendRequest(sServ2 As String, sFile As String, sRet
As String) As Boolean
Dim sMsg As String, sRet1 As String
Dim LRet As Long
On Error Resume Next
sMsg = "GET " & sFile & " HTTP/1.0" & vbCrLf
sMsg = sMsg & "User-Agent: " & UAgent & vbCrLf
sMsg = sMsg & "Host: " & sServ2 & vbCrLf & vbCrLf
LRet = SendData(sMsg, sRet1)
If (LRet <> 0) Then
sRet = sRet1
SendRequest = False
Else
SendRequest = True
End If
End Function

Finally note that I don't need to Start sock. If I forget to do that
then the Request file still works.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: Tony Toews [MVP] on
"Nobody" <nobody(a)nobody.com> wrote:

>> I've been thinking about this and I feel I'd be much better off going
>> directly against the Winsock rather than depending on IE stuff.
>> Whatever MSs definition of stuff is. <smile>
>
>I see that you are trying the Winsock approach, which is fine. However, you
>would have to reinvent the wheel, or use a decent standard DLL if you need
>to support proxy with authentication, if one of your users need it.

Thanks for the comments. I'll keep those in mind. As soon as this
logic is in place and works I plan on making this available on my
website and asking folks to let me know if it doesn't work.

>But remember to check the status code, otherwise you get the textual
>response that the user sees in the browser, such as "500 Internal Error", or
>a fancy 404 error page instead of the actual file.

Trouble is, as discussed in another sub thread, I'm not getting any
kind of status code or 404 or whatever with the httpUC solution. So
I'm rather puzzled.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: mayayana on
I don't know what to think. If you didn't
click Start Sock then you should get error
109 when you try to request a file.

Other than that, it sounds like it's working
OK except that it's not finishing cleanly. The
-1 is coming from OnDownloadFinish. If you
look at the code there, as I mentioned before,
you'll see that it returns the server code unless
there's an error from WReceive, in which case
you get -1. I wouldn't be surprised if you get
an accurate server code in the ServerString
property.

If you don't need to do Start Sock (which is
calling WSAStartup) then that might be the problem.
Maybe you're somehow hooking into an existing
open socket. Why are you not using Start Sock?
And have you tried that at all?

>
> >? I mean that the error on the non-existing file
> >seems to indicate the connection was broken.
> >Am I misinderstanding? With a successful
> >communication (whether there's a file or not)
> >the return code (from the RequestFile function)
> >should be 0 while the server code should be 200,
> >301, 404, etc. I was assuming that you got 200
> >in the iErrCode box when you downloaded a file,
> >with return code of 0.
> >(You can't get anything but 0 or 99+ on the return,
> >code, which shows in the upper box marked
> >"return code".)
>
> No matter if I download a genuine file or not, from a valid domain
> name, I always get
> Return Code: 0
> Return String File: requested succeeded
> Errcode: -1
> ErrStr: 10038
>
> Now if I put in mvps.orggg I get
> Return Code: 112
> Return String: Failed to resolve server IP address.
> which is expected.
>
> If I download a non existent file on mvps.org I get in the textbox.
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>404 Not Found</title>
> </head><body>
> <h1>Not Found</h1>
> <p>The requested URL /asdfsadf was not found on this server.</p>
> </body></html>
>
> > Have I got that right? Another thought I had: It sounds
> >like you're doing GETs, but if you're doing HEAD that might
> >make a difference.
>
> Haven't yet touched that code to change it to HEAD (or rather give
> that as on option.)
>
> Private Function SendRequest(sServ2 As String, sFile As String, sRet
> As String) As Boolean
> Dim sMsg As String, sRet1 As String
> Dim LRet As Long
> On Error Resume Next
> sMsg = "GET " & sFile & " HTTP/1.0" & vbCrLf
> sMsg = sMsg & "User-Agent: " & UAgent & vbCrLf
> sMsg = sMsg & "Host: " & sServ2 & vbCrLf & vbCrLf
> LRet = SendData(sMsg, sRet1)
> If (LRet <> 0) Then
> sRet = sRet1
> SendRequest = False
> Else
> SendRequest = True
> End If
> End Function
>
> Finally note that I don't need to Start sock. If I forget to do that
> then the Request file still works.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
> For a free, convenient utility to keep your users FEs and other files
> updated see http://www.autofeupdater.com/
> Granite Fleet Manager http://www.granitefleet.com/


From: Nobody on
"Tony Toews [MVP]" <ttoews(a)telusplanet.net> wrote in message
news:0a1kf5t9k0r36o8s4q86ui4os2i5vvcef0(a)4ax.com...
> Trouble is, as discussed in another sub thread, I'm not getting any
> kind of status code or 404 or whatever with the httpUC solution. So
> I'm rather puzzled.

The 404 or whatever error code is stored in httpUC.ServerCode. It's also
provided as a parameter in Sock1_OnDownloadFinish() event.


From: Tony Toews [MVP] on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote:

>? I mean that the error on the non-existing file
>seems to indicate the connection was broken.
>Am I misinderstanding? With a successful
>communication (whether there's a file or not)
>the return code (from the RequestFile function)
>should be 0 while the server code should be 200,
>301, 404, etc. I was assuming that you got 200
>in the iErrCode box when you downloaded a file,
>with return code of 0.
>(You can't get anything but 0 or 99+ on the return,
>code, which shows in the upper box marked
>"return code".)

Not that it matters too much for our discussion but I checked my
server logs and I see it returned 200 for an existing file and 404 for
a non existent file as you'd expect.

2009-11-11 00:02:17 209.115.204.52 GET
/_download/AutoFEUpdaterV1.80.zip - 80 - 205.206.29.19 HTTP/1.0
YOUR+NAME+HERE - - www.autofeupdater.com 200 0 0 108226 107 1187
and
2009-11-11 00:03:26 209.115.204.52 GET
/_download/AutoFEUpdaterV1.8zzz0.zip - 80 - 205.206.29.19 HTTP/1.0
YOUR+NAME+HERE - - www.autofeupdater.com 404 0 2 1849 110 78

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: Printing the Form
Next: Common Controls 5.0 / Windows 7