When I try to make POST requests in Xamarin the time the function `GetRequestStream()` takes is 10-20 seconds. The answer time on my server is below 1 second and so is the POST request I made from a website.

I already tried:

* Setting proxy server to null so it won't look it up
* Using blocks around the requests so it get's flushed
* Increased the maximum connections
* Did everything with async multithreading
* Even tried another class called RestSharp - same result.

Nothing I did was actually helping to reduce the runtime even by 100 milliseconds. I just cannot imagine that this is Xamarins fault because I can't be the only one who decided to do some HTTP requests in his cross platform app. I already lost UWP since the ServiceManager, which I use to connect to TLS sites isn't supported in UWP - thank you Xamarin.

I really need solutions so please help :) 

---

this is the code i used and optimized:

```
byte[] byteArray = Encoding.UTF8.GetBytes(query);
HttpWebRequest webRequest = new HttpWebRequest(uri);
webRequest.Method = "POST";
webRequest.Proxy = null;
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Timeout = 1000;
webRequest.ReadWriteTimeout = 1000;
Stream dataStream = await webRequest.GetRequestStreamAsync();
await dataStream.WriteAsync(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse webResponse = await webRequest.GetResponseAsync();
using (StreamReader reader = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8))
{
     string ret = await reader.ReadToEndAsync();
     return ret;
}

```

and this is the code i tried with the ModernHttpClient

```
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(new NativeMessageHandler());
Dictionary<string, string> values = new Dictionary<string, string>();
string[] q = query.Split('&');
for (int i = 0; i < q.Length; i++)
     values.Add(q[i].Split('=')[0], q[i].Split('=')[1]);
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
HttpResponseMessage response;
try
{
     response = await client.PostAsync(uri, content);
     string answer = await response.Content.ReadAsStringAsync();
     return answer;
}
catch (Exception e)
{
     return "";
}

```

and of course i added these lines before calling the whole network stuff

```
ServicePointManager.ServerCertificateValidationCallback += (a, b, c, d) => { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.Expect100Continue = false;
ServicePointManager.DefaultConnectionLimit = 100;

```

---

It's definitely a Xamarin or an Android Problem. I don't have other devices to test it,but... what can i do now? I tested it on a .Net console application, so it's definitely not .Net related.