realbasic-nug
[Top] [All Lists]

Re: Socket Taking Over. Need a Thread?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Socket Taking Over. Need a Thread?
From: Charles Yeomans <charles at declareSub dot com>
Date: Sat, 29 Dec 2007 17:57:29 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <33A8632C-4B8C-44BD-8DBB-2890C1CE61AA at jettfuel dot net> <B0821156-885D-4D7D-BDEA-C9C40BE4FA8A at declareSub dot com> <1C07BFCB-73B1-4ED2-8BBD-BD184DE42731 at jettfuel dot net>
On Dec 29, 2007, at 5:46 PM, Christopher Jett wrote:

>
> On Dec 29, 2007, at 3:14 PM, Charles Yeomans wrote:
>
>>
>> On Dec 29, 2007, at 4: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?
>>> --
>>
>>
>> If your code is of the form
>>
>> buffer = buffer + new data
>>
>> then you could probably improve performance by replacing + with Join
>> -- something like this.
>>
>> Private Property InternalBuffer() as String
>>
>> InternalBuffer.Append new Data
>>
>> Function Data() as String
>>   dim theData as String = Join(InternalBuffer, "")
>>   redim InternalBuffer(-1)
>>   InternalBuffer.Append theData
>>   return theData
>> End Function
>>
>>
>> The idea might be to grab the data once the data transfer is  
>> complete.
>
> Actually, I already have it setup exactly like that.  I'm just
> wondering if there's a way to make the app more responsive while the
> file upload is taking place.  Any thoughts on how to do that?

Maybe, but I'd need to see more code.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>