public static bool Sinc(int v, out List<Ma> x)
{
try
{
XmlDocument urlData = new XmlDocument();
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://192.168.1.155/Ser.svc/maq/?v=" + v;
rq.Timeout = 30000;
HttpWebResponse response = rq.GetResponse() as HttpWebResponse;
using (Stream responseStream = response.GetResponseStream())
{
XmlTextReader reader = new XmlTextReader(responseStream);
urlData.Load(reader);
}
XmlNodeList companyList = urlData.GetElementsByTagName("VP");
List<Ma> z = new List<Ma>();
foreach (XmlNode node in companyList)
{
......
}
if (z.Count != 0)
{
x = z;
return true;
}
else
{
x = z;
return false;
}
}
catch
{
x = null;
return false;
}
}
I use this function to get data from my WEBSERVICE
, when I use it the first time it works without any problems. When I use it the second time it gives me error of timeout
, I leave the application and enter and return to work correctly. Anyone know what it might be?