Esempio n. 1
0
        public CC(String subnetwork, String port)
        {
            this.subnetwork = subnetwork;

            IPAddress localaddr = IPAddress.Parse("127.0.0.1");

            try
            {
                listener = new TcpListener(localaddr, Convert.ToInt32(port));
                listener.Start();
            }
            catch (SocketException)
            {
                Console.WriteLine(DateTime.Now + " Błąd uruchamiania SubnetworkControllera");
            }

            Console.WriteLine(DateTime.Now + " SubnetworkController uruchomiony");
            Thread thread = new Thread(RunServ);

            thread.Start();



            try
            {
                tcpClient = new TcpClient("127.0.0.1", 40002);
            }


            catch (SocketException)
            {
                Console.WriteLine(DateTime.Now + " Nie udało się nawiązać połączenia z RootConrrollerem");
            }
            try
            {
                stream = tcpClient.GetStream();
                input  = new StreamReader(stream);
                output = new StreamWriter(stream);
            }
            catch (IOException)
            {
                Console.WriteLine(DateTime.Now + " Błąd strumienia wejścia/wyjścia");
            }
            ccClient = new CCclient(this, subnetwork, output, input);
            Thread th = new Thread(ccClient.Run);

            th.Start();

            lrm = new LRM(subnetwork);
            rc  = new RC();
            rc.stworzGraf(lrm.getLacza());
        }
Esempio n. 2
0
 public AgentService(Socket socket, CC cc, CCclient ccClient)
 {
     this.cc       = cc;
     this.socket   = socket;
     this.ccClient = ccClient;
 }