Skip to content

Commit

Permalink
Setting connection timeout for http
Browse files Browse the repository at this point in the history
  • Loading branch information
davekartik24 committed Oct 30, 2018
1 parent 4f9d59e commit 96bdd75
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions LitleSdkForNet/LitleSdkForNet/Communications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ public virtual string HttpPost(string xmlRequest, Dictionary<string, string> con
req.ServicePoint.MaxIdleTime = 8000;
req.ServicePoint.Expect100Continue = false;
req.KeepAlive = false;

//set timeout for request if available. #Issue 58
//connection timeout is increased 3 times on successful establishment.
if(config.ContainsKey("timeout") && config["timeout"] != null && int.Parse(config["timeout"]) > 0)
{
var timeOut = int.Parse(config["timeout"]);
req.Timeout = timeOut;
req.ReadWriteTimeout = 3*timeOut;
}


if (IsProxyOn(config))
{
var myproxy = new WebProxy(config["proxyHost"], int.Parse(config["proxyPort"]))
Expand Down

0 comments on commit 96bdd75

Please sign in to comment.