# URLConnection "Error occurred while receiving response from server"

**URL:** <https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010>\
**Category:** Windows\
**Created:** [September 14, 2020, 3:01pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010 "2020-09-14T15:01:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [September 14, 2020, 3:01pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/1 "2020-09-14T15:01:26Z")

</div>

I have customers on Windows reporting this error while making POST requests. Not all customers, but enough. It seems to be all POST requests with some sort of body. GET requests work fine. Server doesn’t seem to matter.

The message of the exception is

> Error occurred while receiving response from server

Does anybody have any insight to what this actually means? Or how I could help my users troubleshoot this?

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [September 14, 2020, 3:10pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/2 "2020-09-14T15:10:38Z")

</div>

What versions of Windows? I wonder if it might be related to TLS version…

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [September 14, 2020, 3:15pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/3 "2020-09-14T15:15:18Z")

</div>

Shouldn’t be, since the connection works. It’s Windows 10 anyway. 18362 in this most recent instance, but I don’t think the specific build matters.

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [September 14, 2020, 3:34pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/4 "2020-09-14T15:34:10Z")

</div>

> [@Thom\_McGrath](#):
>
> Error occurred while receiving response from server

Is the server in your hands?

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [September 14, 2020, 3:35pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/5 "2020-09-14T15:35:50Z")

</div>

I’ve considered that it could be malware protection terminating the connection, but in all cases that have been reported, users are just using Defender. So am I, and Defender doesn’t do anything like that anyway.

> [@DerkJ](#):
>
> Is the server in your hands?

In this specific test, no. Though I do have users report a issue with my server that is something like “connection failed, maybe a bad url.” But the url isn’t bad and works for the overwhelming majority of users. That request is also a POST request.

---

<div class="post-metadata">

**Author:** ![Antonio\_Rinaldi](https://forum.xojo.com/user_avatar/forum.xojo.com/antonio_rinaldi/32/331_2.png) [@Antonio\_Rinaldi](https://forum.xojo.com/u/Antonio_Rinaldi)\
**Post date:** [September 14, 2020, 5:44pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/6 "2020-09-14T17:44:00Z")

</div>

Maybe it’s a firewall rule

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [September 20, 2020, 5:45am UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/7 "2020-09-20T05:45:37Z")

</div>

New clue to this mystery: partial content is received by the server. In this case it’s attempting to upload a file. An initial request submits the metadata which returns a token and url, then a second request is made to that url to actually send the file content. There is definitely partial content being received. In the case I’m working with, the content was cut off after about 900,000 ASCII characters, though I’ve tested with ~1.3m characters without issue. I still have not been able to reproduce the issue.

It’s also not a consistent error either. I had one user we were working on for hours, I finally prepared a specialized build that would include the error number in the log message… and it started working for him before even installing that build. It’s bizarre.

@William_Yu Sorry to tag you directly, but this appears to be a Xojo error message. At least, it doesn’t return any Google results except for this forum post, so it’s probably a message in Xojo’s Windows URLConnection code. When you get a chance, would you mind looking at the code to see if there are any clues as to what might be triggering this?

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [September 20, 2020, 6:36am UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/8 "2020-09-20T06:36:02Z")

</div>

So i wonder if this could be the length header. If you provide an upload can you post the headers?

It could be that the server is thinking some kind of length that’s incorrect?

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [September 20, 2020, 10:51am UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/9 "2020-09-20T10:51:09Z")

</div>

Yeah it’s a good idea, but I already tried that. The Content-Length header is not only included by Xojo already, but it’s correct too.

---

<div class="post-metadata">

**Author:** ![William\_Yu](https://forum.xojo.com/user_avatar/forum.xojo.com/william_yu/32/610_2.png) [@William\_Yu](https://forum.xojo.com/u/William_Yu)\
**Post date:** [September 21, 2020, 1:59pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/10 "2020-09-21T13:59:37Z")

</div>

The specific error is an API\_RECEIVE\_RESPONSE error (received as a WINHTTP\_CALLBACK\_STATUS\_REQUEST\_ERROR) but the actual error code number will not be of much help since we’re not populating it correctly (bug filed Feedback Case #61804).

---

<div class="post-metadata">

**Author:** ![Tomas\_Sancio](https://forum.xojo.com/user_avatar/forum.xojo.com/tomas_sancio/32/1187_2.png) [@Tomas\_Sancio](https://forum.xojo.com/u/Tomas_Sancio)\
**Post date:** [January 8, 2021, 2:42pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/11 "2021-01-08T14:42:37Z")

</div>

Hi, is there a way to see which port URLConnection is using? A customer with a Firewall wants to know which port our app (made with Xojo) will use. Thanks

---

<div class="post-metadata">

**Author:** ![George\_Ashkar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/g/8baadc/32.png) [@George\_Ashkar](https://forum.xojo.com/u/George_Ashkar)\
**Post date:** [February 12, 2021, 8:54pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/12 "2021-02-12T20:54:07Z")

</div>

Did you end up figuring out what it was? I’ve been experiencing the same thing randomly with several customers as well.

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [February 12, 2021, 9:07pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/13 "2021-02-12T21:07:02Z")

</div>

Not exactly, but I think it’s a timeout issue.

---

<div class="post-metadata">

**Author:** ![George\_Ashkar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/g/8baadc/32.png) [@George\_Ashkar](https://forum.xojo.com/u/George_Ashkar)\
**Post date:** [February 12, 2021, 9:53pm UTC](https://forum.xojo.com/t/urlconnection-error-occurred-while-receiving-response-from-server/57010/14 "2021-02-12T21:53:03Z")

</div>

OK thank you for the info.
