I have big problem. I need send 200 objects at a time,
here is my code :
while (true)
{
NameValueCollection myNameValueCollection = new NameValueCollection();
myNameValueCollection.Add("mode", nat);
myNameValueCollection.Add("mode", nat);
using (var client = new WebClient())
{
byte[] responseArray = client.UploadValues(serverA, myNameValueCollection);
answer= Encoding.ASCII.GetString(responseArray);
answer= Convert.ToString(answer);
string[] split =
Javab.Split(new[] { '!' }, StringSplitOptions.RemoveEmptyEntries);
string comand = split[0];
string sever= split[1];
string op1 = split[2];
string op2 = split[3];
string op3 = split[4];
switch (comand)
{
case "check":
int ops1 = Convert.ToInt32(op1);
for (int i = 0; i < ops1; )
{
Uri myUri = new Uri(server);
WebRequest myWebRequest = WebRequest.Create(myUri);
myWebRequest.Timeout = 200000;
WebResponse myWebResponse = myWebRequest.GetResponse();
i++;
}
break;
}
}
}
and i get this error
Unhandled Exception: System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at vir_fu.Program.Main(String[] args)
a part of code , like this
for (int i = 0; i < ops1; )
{
Uri myUri = new Uri(site);
WebRequest myWebRequest = WebRequest.Create(myUri);
myWebRequest.Timeout = 200;
WebResponse myWebResponse = myWebRequest.GetResponse();
i++;
}
Work great out side of my base code , but when I add this code in my project I get that error , i tried set timeout = 200 ; but didn't work.
What can i do?