コード例 #1
0
ファイル: Program.cs プロジェクト: nesbocaj/observer-pattern
        public Program()
        {
            Console.WriteLine("Provider Server");

            _connection = TcpConnection.Instance;
            _provider = TcpProvider.Instance;
            _messages = new string[] {
                "The",
                "quick",
                "brown",
                "fox",
                "jumps",
                "over",
                "the",
                "lazy",
                "dog"
            };

            var listenWorker = new Thread(_connection.Listen);
            listenWorker.Name = "Listen Worker";
            listenWorker.Start();

            var notifyWorker = new Thread(Notify);
            notifyWorker.Name = "Notify Worker";
            notifyWorker.Start();
        }
コード例 #2
0
 private TcpConnection()
 {
     _requestEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7000);
     _postEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7001);
     _listener = new TcpListener(_requestEndpoint);
     _client = new TcpClient(_postEndpoint);
     _provider = TcpProvider.Instance;
 }