public static void InitMdis() { routingTable.SetRoute(Program.MijnPoort, Program.MijnPoort, 0); nodes.Add(Program.MijnPoort); foreach (KeyValuePair <int, Connection> buur in Program.Buren) { // send Mydist MijnPoort 0 to buur Console.WriteLine("InitMdis:"); sendMmessageTo(buur, Program.MijnPoort, Program.MijnPoort, 0); //sendMmessageTo(buur, Program.MijnPoort, 1); if (!nodes.Contains(buur.Key)) { nodes.Add(buur.Key); } Console.WriteLine("TEST: " + buur.Key); } }
static void Main(string[] args) { //Initialisatie. MijnPoort = int.Parse(args[0]); Console.Title = "NetChange " + args[0]; new Server(MijnPoort); Du.Add(MijnPoort, 0); Ndis.Add(new Tuple <int, int>(MijnPoort, MijnPoort), 0); Nb.Add(MijnPoort, MijnPoort); routingTable.SetRoute(MijnPoort, MijnPoort, 0); for (int t = 1; t < args.Length; t++) { int anderePoort = int.Parse(args[t]); if (MijnPoort < anderePoort) { if (!Buren.ContainsKey(anderePoort)) { while (!Buren.ContainsKey(anderePoort)) { Buren.Add(anderePoort, new Connection(anderePoort)); } Ndis.Add(new Tuple <int, int>(anderePoort, anderePoort), 1); Du.Add(anderePoort, 1); Nb.Add(anderePoort, anderePoort); //pref neighbour; (nb, destination) routingTable.SetRoute(anderePoort, anderePoort, 1); NetChange.UpdateDist(anderePoort, MijnPoort, 1); Console.WriteLine("INITIAL Verbonden: " + anderePoort); //NetChange.Recompute(anderePoort); } } } NetChange.InitMdis(); //Na de initialisatie. while (true) { listenForUserInput(); } }