Esempio n. 1
0
        private void BgThreadLoop()
        {
            HostConnectResult result = null;

            try
            {
                result = FollowHostConnectProtocol();
                if (!string.IsNullOrEmpty(result.Error))
                {
                    Logger.Debug(result.Error);
                }
            }
            catch (ThreadAbortException) { }
            catch (SocketException) { }
            catch (EndOfStreamException) { }             // ordinary socket disconnect
            catch (Exception ex)
            {
                Logger.Debug(ex);
            }
            finally
            {
                State = HostConnectClientState.Disconnected;
                StateChanged(this, new StateChangedEventArgs(result, State));
            }
        }
        public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData)
        {
            string pageLower = p.requestedPage.ToLower();

            p.tcpClient.NoDelay = true;
            if (pageLower == "json")
            {
                JSONAPI.HandleRequest(p, inputData.ReadToEnd());
            }
            else if (pageLower == "hostconnect")
            {
                HostConnectResult result = HostConnect.HandleHostService(p);
                if (result.Error != null)
                {
                    Console.WriteLine(result.Error);
                }
            }
        }
Esempio n. 3
0
 public StateChangedEventArgs(HostConnectResult result, HostConnectClientState state)
 {
     this.result = result;
     this.state  = state;
 }