Hello,
I generally avoid creating my own buffer since the socket is already
buffering data internally. I think in almost all cases the HTTP client
will send a Content-Length header with the total size of the file.
Since you appear to be keeping the whole thing in memory anyway, it
would probably be fine to just avoid reading from the buffer until
you've received the file in its entirety:
if LenB(LookAhead) >= ContentLength then
Data = Read(ContentLength)
end if
Using the above approach might speed things up quite a bit.
Thanks,
Navdeep Bains
Bains Software
On Dec 29, 2007, at 1:05 PM, Christopher Jett wrote:
> I am working on an HTTP server that will be incorporated into several
> projects. In testing, I have an HTML page with a form that allows
> upload of a file. Everything is working fine, but the application
> becomes unresponsive when uploading a file of any size. I have in
> the DataAvailable event code that reads what's in the socket buffer
> and adding it to an string that is acting as a buffer. Is there a
> better way to implement things so that the application remains
> responsive and other connections can continue to operate? Should I
> try using a Thread to handle reading the data and remove the code
> from the DataAvailable event?
> --
> Chris Jett
> chris at jettfuel dot net
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|