HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress
HTTP Post Upload Progress HTTP Post Upload Progress
HTTP Post Upload Progress
Go Back  Xtreme Visual Basic Talk > > > HTTP Post Upload Progress


Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2011, 06:09 PM
BrinK BrinK is offline
Newcomer
 
Join Date: Oct 2008
Posts: 7
Default HTTP Post Upload Progress


I've been racking my brain trying to come up with a way to get the progress of a HTTP POST upload. The reason for wanting to track the progress is because I'm performing an image upload of screenshots sometimes over a MB.

Currently I can do the POST using inet OR winsock, but for the life of me I can't work out how to get the progress on either.

With Winsock I've tried splitting up the data I'm sending but it seems to still send it all at once.

Code:
Debug.Print "Sending first... " & Now
    Winsock.SendData sData(0)
            
    Debug.Print "Sending second... " & Now
    Winsock.SendData sData(1)
Outputs;
Sending first... 11/02/2011 9:41:53 AM
Sending second... 11/02/2011 9:41:53 AM
Send Complete....11/02/2011 9:41:53 AM

While the winsock is still actually uploading. That doesn't make sense. I'm getting a Send complete from the Winsock complete event when the Winsock object hasn't actually finished. Winsock_SendProgress does the same. It reports back that there is 0 bytes remaining when the winsock object is still in the process of uploading...

With inet I'm using;
Code:
Inet.Execute "URL", "POST", arr(0), arr(1) '// arr(0) = Body and arr(1) = Header
I guess the question is, can I actually track the progress of a HTTP Post upload?

Last edited by BrinK; 02-10-2011 at 06:18 PM.
Reply With Quote
  #2  
Old 02-11-2011, 07:45 AM
dilettante's Avatar
dilettanteHTTP Post Upload Progress dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,529
Default

The SendComplete doesn't mean the last send has actually completed.

What it really means is "I have enough room in the output buffer to accept another send request from you now" and it is meant for you to use it to send subsequent chunks of data folowing an initial send.

I think it fires when there is 8KB of space in the buffer.

Sendprogress is similar, but should fire multiple times until the buffer is empty.


HTTP "uploading" is a transaction. It isn't complete until you get the server's reply back. Perhaps that's why you see 0 bytes remaining (to send) even though you don't consider the "upload" complete?

Or if you're monitoring the bytes flowing at some level consider that there are at least 4 levels of buffering involved:
  • Your source data variable's contents.
  • The Winsock control's "stretchy" output buffer.
  • The underlying socket's non-paged pool memory fixed output buffer, defaulting to 8KB.
  • The network card's buffer(s).
Some recent network cards contain a lot of buffer space as well as the "smarts" to recognize and handle outbound TCP traffic, offloading effort from the CPU and main memory.

The net result is that "progress" measurement is vague at best in a lot of circumstances. A lot of software cheats and gives what indication it can up to a point, then leaves 10% or so "open" (incomplete) until the server's response comes back.
Reply With Quote
  #3  
Old 02-11-2011, 05:37 PM
BrinK BrinK is offline
Newcomer
 
Join Date: Oct 2008
Posts: 7
Default

Ah, that makes sense. Thanks for the post dilettante, much appreciated.

After exhausting all the options I could think up I've come to the conclusion that this may not be as trivial as I had first thought it would be.
Reply With Quote
  #4  
Old 02-12-2011, 05:40 AM
dilettante's Avatar
dilettanteHTTP Post Upload Progress dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,529
Default

I think you can only do what you can do and then fake the rest. At least that's what it seems others are doing.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress HTTP Post Upload Progress
HTTP Post Upload Progress
HTTP Post Upload Progress
 
HTTP Post Upload Progress
HTTP Post Upload Progress
 
-->