コード例 #1
0
ファイル: Form1.cs プロジェクト: tdhieu/openvss
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         string appPath =  Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
         httpServer = new VsMediaProxyServer(int.Parse(textBox2.Text), textBox3.Text
             ,appPath);
         httpServer.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
        void vsWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            File.AppendAllText(Path.Combine(appPath, "MediaProxyServiceMsg.txt"), DateTime.Now.ToString() + "DoWork\r\n");
           // string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
            //File.AppendAllText("c:\\serviceMsg.txt", appPath + "appPath\r\n");


            try
            {
                string ProviderPath = Path.Combine(appPath, "Provider");
                httpServer = new VsMediaProxyServer(8080, "C:\\VsData"
                    , appPath, ProviderPath);

            }
            catch (Exception ex)
            {
                File.AppendAllText(Path.Combine(appPath, "MediaProxyServiceMsg.txt"), DateTime.Now.ToString() + ex.Message + "\r\n");
                return;
            }
            httpServer.Start();

            control = true;
          
            while (control)//(!vsWorker.CancellationPending && !bLoop)
            {
                // DateTime date = DateTime.Now;

                // if (date.Hour == vsHour && date.Minute >= vsMinute && date.Minute <= vsMinute + 1) bLoop = true;
               // File.AppendAllText("c:\\serviceMsg.txt", HttpServer.output + "output\r\n");
                Thread.Sleep(5000);
            }
           // File.AppendAllText("c:\\serviceMsg.txt", "out loop\r\n");
        }
コード例 #3
0
ファイル: HttpRequestParsing.cs プロジェクト: tdhieu/openvss
        public void ProcessRequest(TcpClient client, HttpServer Parent)
        {
            this.Parent = Parent;
            this.client = client;

            byte[] myReadBuffer = new byte[client.ReceiveBufferSize];
            String myCompleteMessage = "";
            int numberOfBytesRead = 0;


            ns = client.GetStream();

        
            /// Incoming message may be larger than the buffer size.
            do
            {
                numberOfBytesRead = ns.Read(myReadBuffer, 0, myReadBuffer.Length);

                myCompleteMessage =
                    String.Concat(myCompleteMessage, Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));

                strParsing(myCompleteMessage, myReadBuffer, numberOfBytesRead);

                if (ParserState != RState.OK)
                {
                    numberOfBytesRead = 0;
                    numberOfBytesRead = ns.Read(myReadBuffer, 0, myReadBuffer.Length);

                    if (numberOfBytesRead > 0)
                    {
                        myCompleteMessage = Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead);

                        strParsing(myCompleteMessage, myReadBuffer, numberOfBytesRead);
                    }
                    //String.Concat(myCompleteMessage, );
                }
             
            }
            while (ns.DataAvailable);



            //HTTPResponse.status = (int)RespState.BAD_REQUEST;
        }