I want to send data every two minutes.
Right now, I have the following code:
using (var client = new WebClient())
{
byte[] responseArray = client.UploadValues(Server, myNameValueCollection);
Answer = Encoding.ASCII.GetString(responseArray);
}
I don't know how can I do this. I tried to add something like this to my code:
private void SendData()
{
...
using (var client = new WebClient())
{
byte[] responseArray = client.UploadValues(Server, myNameValueCollection);
Answer = Encoding.ASCII.GetString(responseArray);
}
}
And call it at:
public void main(object sender, EventArgs e)
{
Thread iThread = new Thread(new ThreadStart(SendData));
iThread.Start();
iThread.Sleep();
}
But no luck. My program is a C# Console Application.