Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string clientNum = args[0];

            HTTPClientBasic client = new HTTPClientBasic(IPAddress.Parse(args[1]), int.Parse(args[2]), clientNum);

            client.Start();

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public String GenerateRequest()
        {
            HTTPClientBasic clientBasic   = new HTTPClientBasic();
            String          requestClient = null;
            string          requestUrl    = deviceName + "/" + requestSize;

            if (MethodType.Equals("GET"))
            {
                string host = clientBasic.Address + ":" + clientBasic.Port;
                requestClient = String.Format("{0} {1} {2}\r\nHost:{3}\r\n\r\n{4}",
                                              MethodType, requestUrl, "HTTP/1.1", "0", Data);
            }
            else if (MethodType.Equals("POST"))
            {
                requestClient = String.Format("{0} {1} {2} \r\nHost:{3}\r\nContent-length:{4}\r\nContent-type:{5}\r\n\r\n{6}", //host = clientBasic.Address + ":" + clientBasic.Port
                                              MethodType, requestUrl, "HTTP/1.1", "0", Data.Length, "application/x-www-form-urlencoded", Data);
            }
            return(requestClient);
        }