Hi,

My situation:
I want to send some information to a webserver.
I have a program that generating the information and I have a webserver wich can collect this information and put it into a database.

At the moment I use a small (self-created) C# program where the information will we added as params. The command that I currently use is for example;
C:\post_to_web.exe "information string 1" "information string 2"

The problem I currently have is that sometimes the information goes very quick after each other. That cause problems on the database, where the messages must be connected to each other.

I was thinking about creating a program that runs in the background where another program is connecting to. At this way every message will be send after each other, what's solving my problem.

How can I do this? Or do you have a better idea?

The code of my currently program is;

Code:
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Net;

namespace Post
{
    class Program
    {
        static void Main(string[] args)
        {
            string post_url = "http://www.mywebsite.nl/input/";

            if (args.Count() == 2)
            {
                try
                {
                    string data1 = args[0];
                    string data2 = args[1];

                    Console.WriteLine("DATA1: " + data1);
                    Console.WriteLine("DATA2: " + data2);

                    Console.WriteLine("Start request to: " + post_url);
                    byte[] buffer = Encoding.ASCII.GetBytes("data1="+data1+"&data2="+data2);
                    HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(post_url);
                    WebReq.Method = "POST";
                    WebReq.UserAgent = "Poster";
                    WebReq.ContentType = "application/x-www-form-urlencoded";
                    WebReq.ContentLength = buffer.Length;
                    Stream PostData = WebReq.GetRequestStream();
                    PostData.Write(buffer, 0, buffer.Length);
                    PostData.Close();

                
                    HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();

                    Console.WriteLine("Status: " + WebResp.StatusCode);
                    Console.WriteLine("Connected with: " + WebResp.Server);
                }
                catch (WebException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                Console.WriteLine("Fout, ongeldig aantal paramaters opgegeven ("+args.Count()+"/2)");
            }
        }
    }
}