# HTTPSocket using 95% cpu

**URL:** <https://forum.xojo.com/t/httpsocket-using-95-cpu/31810>\
**Category:** Windows\
**Created:** [June 5, 2016, 4:19pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810 "2016-06-05T16:19:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Weger](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@Charles\_Weger](https://forum.xojo.com/u/Charles_Weger)\
**Post date:** [June 5, 2016, 4:19pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/1 "2016-06-05T16:19:59Z")

</div>

I’ve just started using an HTTPSocket (classic, not the new framework) in a Windows app. It talks to another app on the same machine that uses SOAP. I finally figured out the SOAP format and am successfully communicating. However, the other app can take a LONG time to reply (hundreds of seconds, sometimes). Currently, my socket is synchronous;

```auto
Dim response as string = mySocket.Post(theURL, 5000)
```

Everything works fine, but my app shows up in Task Manager as using 95% (or more) of the cpu for the duration, until the other app replies. Is this normal for HTTPSockets?

I can probably refactor things to make it asynchronous. A hassle, but if that’s the only way around this I’ll do that.

Thoughts?

Thanks!

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [June 5, 2016, 4:23pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/2 "2016-06-05T16:23:41Z")

</div>

I’d use async if you can

---

<div class="post-metadata">

**Author:** ![Charles\_Weger](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@Charles\_Weger](https://forum.xojo.com/u/Charles_Weger)\
**Post date:** [June 5, 2016, 4:34pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/3 "2016-06-05T16:34:30Z")

</div>

Thanks Norman, I guess I’ll bite the bullet and do that.

Paris? I thought you were in Canada. Watch out for high water!

---

<div class="post-metadata">

**Author:** ![Ashot\_Khachatryan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@Ashot\_Khachatryan](https://forum.xojo.com/u/Ashot_Khachatryan)\
**Post date:** [June 5, 2016, 9:17pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/4 "2016-06-05T21:17:30Z")

</div>

Do mySocket.Yield = True before the Post

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [June 6, 2016, 12:03am UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/5 "2016-06-06T00:03:04Z")

</div>

> [@270153:@Ashot Khachatryan](#):
>
> Do mySocket.Yield = True before the Post

I wouldn’t. That uses a call to DoEvents up the background which could make bugs really hard to track down. You’ll be better off wrapping your head around async events as they’re way more efficient and cpu friendly in the long run.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [June 6, 2016, 1:17am UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/6 "2016-06-06T01:17:04Z")

</div>

[quote=270111:@Charles Weger]Thanks Norman, I guess I’ll bite the bullet and do that.

Paris? I thought you were in Canada. Watch out for high water![/quote]  
We left the day it started raining like mad (by pure coincidence)  
When we got home 2 days later we saw reports about the rising levels & 2 days after that the water was up over places we had literally just stood 5 days before  
Crazy stuff

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:20pm UTC](https://forum.xojo.com/t/httpsocket-using-95-cpu/31810/7 "2020-10-29T18:20:55Z")

</div>


