I think that this may be one of the few situations in which you can
use App.DoEvents in a GUI application.
do until respArrived
mySocket.Poll
app.DoEvents
loop
Charles Yeomans
On Apr 18, 2007, at 4:41 AM, Guillermo wrote:
> I have the same problem using socket.poll, the loop consumes a lot of
> CPU cycles while waiting for the answer:
>
> ....
> while not respArrived
> mySocket.poll
> wend
>
> I'm searching for a method that the program don't consume CPU while is
> waiting for the answer.
>
> Any idea
>
> Guillermo
>
> 2007/4/15, Guillermo <[EMAIL PROTECTED]>:
>> Thanks Marc, I will try it
>>
>> 2007/4/15, Marc (aliacta.com) <[EMAIL PROTECTED]>:
>>> Hi Guillermo,
>>>
>>> Use TCPSocket.Poll in your loop.
>>>
>>> Cheers,
>>>
>>> Marc
>>>
>>>
>>> On Apr 15, 2007, at 11:44 AM, Guillermo wrote:
>>>
>>>> I'm writing a client-server applications, the server send a
>>>> command to
>>>> the server and it need to wait for the response to continue.
>>>>
>>>> For example, imagine a database server the client send a packet:
>>>>
>>>> ....
>>>> sendToServer("select * from customers")
>>>> ....
>>>>
>>>> The sendToServer method has to send the packet and wait for the
>>>> response, What is the better method to wait? now I have a simple
>>>> loop
>>>> but consumes a lot of CPU (I can't sleep the main thread):
>>>>
>>>> while not respArrived
>>>>
>>>> end while
>>>>
>>>> and in the socket event: respArrived=true
>>>>
>>>> Are there another method?
>>>>
>>>> Thanks in advance
>>>>
>>>> Guillermo
>>> _______________________________________________
>>> 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>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>