Esempio n. 1
0
        public Node(string configurationPath)
        {
            lock (this)
            {
                entryPorts = new List <int>();
                Console.WriteLine(@"
  _   _  ____  _____  ______ 
 | \ | |/ __ \|  __ \|  ____|
 |  \| | |  | | |  | | |__   
 | . ` | |  | | |  | |  __|  
 | |\  | |__| | |__| | |____ 
 |_| \_|\____/|_____/|______|");
                ThreadStart childref    = new ThreadStart(listeningThread);
                Thread      childThread = new Thread(childref);
                childThread.Start();
                this.sender = new SenderSocket();

                sf = new SwitchingField();

                this.configurationPath = configurationPath;
                string[] prefixes;
                prefixes    = new string[4];
                prefixes[0] = $"http://localhost:{listenerPort - 1000}/refresh/";
                prefixes[1] = $"http://localhost:{listenerPort - 1000}/getSlotsStatus/";
                prefixes[2] = $"http://localhost:{listenerPort - 1000}/getSwitchingTable/";
                prefixes[3] = $"http://localhost:{listenerPort - 1000}/removeEntry/";
                this.server = new WebServer(prefixes, handleResponse);
                this.server.Run();
            }
        }
Esempio n. 2
0
        public CableCloud()
        {
            Console.WriteLine(@"
   _____          ____  _      ______    _____ _      ____  _    _ _____  
  / ____|   /\   |  _ \| |    |  ____|  / ____| |    / __ \| |  | |  __ \ 
 | |       /  \  | |_) | |    | |__    | |    | |   | |  | | |  | | |  | |
 | |      / /\ \ |  _ <| |    |  __|   | |    | |   | |  | | |  | | |  | |
 | |____ / ____ \| |_) | |____| |____  | |____| |___| |__| | |__| | |__| |
  \_____/_/    \_\____/|______|______|  \_____|______\____/ \____/|_____/ ");
            for (int i = 1; i < 15; i++)
            {
                //Console.WriteLine("LRM up!");
            }
            this.sender = new SenderSocket();
            for (int i = 0; i < portNums.Count; i++)
            {
                currentPortNum = portNums[i];
                ThreadStart childref    = new ThreadStart(listeningThread);
                Thread      childThread = new Thread(childref);
                childThread.Start();
                Thread.Sleep(100);
            }
            this.nodesConnections = new List <Tuple <int, int> >();
            this.connectionsMap   = new List <Tuple <int, int> >();
            this.client           = new HttpClient();
        }
Esempio n. 3
0
        public Client(int listenerPort, int targetPort, int myInterface, int adjacentNodeId)
        {
            Console.WriteLine(@"
   _____ _      _____ ______ _   _ _______ 
  / ____| |    |_   _|  ____| \ | |__   __|
 | |    | |      | | | |__  |  \| |  | |   
 | |    | |      | | |  __| | . ` |  | |   
 | |____| |____ _| |_| |____| |\  |  | |
  \_____|______|_____|______|_| \_|  |_|");
            this.listenerPort   = listenerPort;
            this.targetPort     = targetPort;
            this.myInterface    = myInterface;
            this.adjacentNodeId = adjacentNodeId;
            ThreadStart childref    = new ThreadStart(listeningThread);
            Thread      childThread = new Thread(childref);

            childThread.Start();


            this.sender = new SenderSocket();
            this.client = new HttpClient();
            Console.WriteLine("CallingPartyCallController up!");
        }