public Network(Helper aHelper) { iHelper = aHelper; iBoxList = new List <Box>(); iNetworkChangeWatcher = new NetworkChangeWatcher(); // create the list of network interfaces iInterfaces = new List <NetworkInterface>(); foreach (NetworkInfoModel i in NetworkInfo.GetAllNetworkInterfaces()) { if (i.OperationalStatus == EOperationalStatus.eUp || i.OperationalStatus == EOperationalStatus.eUnknown) { // don't add 3G network card on iPads/iPhones if (i.Name != "pdp_ip0") { iInterfaces.Add(new NetworkInterface(i)); } } } // create separate network stacks for each available interface iNetworkStacks = new List <NetworkStack>(); foreach (NetworkInterface iface in iInterfaces) { if (iface.Status == NetworkInterface.EStatus.eAvailable) { NetworkStack stack = new NetworkStack(aHelper, iface.Info.IPAddress); stack.Boxes.EventRoomAdded += RoomAddedHandler; stack.Boxes.EventRoomRemoved += RoomRemovedHandler; try { // start the stack UserLog.WriteLine(String.Format("{0}: Linn.Wizard.Network starting stack({1})", DateTime.Now, iface.Info.IPAddress.ToString())); stack.Start(); UserLog.WriteLine(String.Format("{0}: Linn.Wizard.Network starting stack({1}) ok", DateTime.Now, iface.Info.IPAddress.ToString())); // success - add it to the list iNetworkStacks.Add(stack); } catch (Exception e) { // failed to start - unhook handlers and ignore UserLog.WriteLine(String.Format("{0}: Linn.Wizard.Network starting stack({1}) failed", DateTime.Now, iface.Info.IPAddress.ToString())); UserLog.WriteLine("Error Message: " + e.Message); UserLog.WriteLine("Error Message: " + e.ToString()); stack.Boxes.EventRoomAdded -= RoomAddedHandler; stack.Boxes.EventRoomRemoved -= RoomRemovedHandler; } } } }