コード例 #1
0
 public QuotationClient(TcpClient tcpClient, QuotationManager quotationManager)
 {
     this._QuotationManager = quotationManager;
     this._TcpClient = tcpClient;
     this._SourceName = "";
     this._ConnectionCheckTimer = new Timer(this.ConnectionCheck);
 }
コード例 #2
0
        public void Start(QuotationManager quotationManager)
        {
            this._QuotationManager = quotationManager;

            this._ListeningThread = new Thread(delegate()
            {
                try
                {
                    this._Listener = new TcpListener(new IPEndPoint(IPAddress.Any, this._ListenPort));
                    this._Listener.Start();
                }
                catch (Exception exception)
                {
                    Logger.TraceEvent(TraceEventType.Error,"QuotationReceiver.Start Can't listen on {0}\r\n{1}", this._ListenPort, exception.ToString());
                    this.Stop();
                    return;
                }

                while (this._Running)
                {
                    try
                    {
                        TcpClient client = this._Listener.AcceptTcpClient();
                        QuotationClient quotationClient = new QuotationClient(client, this._QuotationManager);
                        quotationClient.Start();
                        this._QuotationClients.Add(quotationClient);
                    }
                    catch (Exception exception)
                    {
                        Logger.TraceEvent(TraceEventType.Warning, "QuotationReceiver.Start Accept QuotationClient failed\r\n{0}", exception.ToString());
                        this.Stop();
                        break;
                    }
                }

            }
            );
            this._ListeningThread.IsBackground = true;
            this._ListeningThread.Start();
        }
コード例 #3
0
 public QuotationClient(TcpClient tcpClient, QuotationManager quotationManager)
 {
     this._QuotationManager = quotationManager;
     this._TcpClient = tcpClient;
     this._SourceName = "";
 }