Пример #1
0
        public void RegisterServices(IWindsorContainer container)
        {
            var ipaddress = IpFinder.GetLocalIpAddress();

            string baseAddress = $"http://{ipaddress}:8097/services/";


            container.Register(
                Component.For <IBookService>().ImplementedBy <BookServiceApplication>()
                .AsWcfService(new DefaultServiceModel()
                              .AddEndpoints(WcfEndpoint.ForContract(typeof(IBookService)).BoundTo(new WSHttpBinding
            {
                //PortSharingEnabled = true,
                MaxReceivedMessageSize = int.MaxValue,
                ReceiveTimeout         = new TimeSpan(0, 0, 2, 0, 0),
                CloseTimeout           = new TimeSpan(0, 0, 0, 60, 0),
                Security = new WSHttpSecurity {
                    Mode = SecurityMode.None
                }
            }))
                              .PublishMetadata(c => c.EnableHttpGet())
                              .AddBaseAddresses(new Uri(baseAddress + "books"))).LifestylePerWcfOperation());

            _logger.Info($"Server endpoint on : {baseAddress}books");
        }
Пример #2
0
        private bool ReplaceLocalHost(CommandLineOptions options)
        {
            var localIp = IpFinder.GetLocalIp();

            options.Url = options.Url
                          .Replace("127.0.0.1", localIp)
                          .Replace("localhost", localIp);

            return(true);
        }
Пример #3
0
        public static List <string> hostsNotReachable()
        {
            if (macAdresses.Count > 0)
            {
                foreach (string mac in macAdresses)
                {
                    foreach (IPAddress ip in hostInfo.AddressList)
                    {
                        try
                        {
                            // For Debug Purpose
                            //Console.WriteLine($"ermittelte IP: {ip.ToString().Substring(0, 9)} eigene IP: {IpFinder.GetOwnIPV4().Substring(0, 9)}");
                            if (!String.IsNullOrEmpty(ip.ToString()) && ip.ToString().Substring(0, 9).Equals(IpFinder.GetOwnIPV4().Substring(0, 9)))
                            {
                                IpAdresse = ip.ToString();
                                // For  Debug Purpose
                                //Console.WriteLine(IpAdresse);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }
                    remoteHostIP = IpFinder.FindIpAddressByMacAddress(mac, IpAdresse);

                    if (DeviceScanner.IsHostAccessible(remoteHostIP))
                    {
                        Console.WriteLine($"Rechner {getHostNameFromIp(remoteHostIP)} mit IP:{remoteHostIP} ist nun erreichbar\r\n");
                    }
                    else
                    {
                        HostsOffline.Add(remoteHostIP);
                    }
                }
            }
            return(HostsOffline);
        }
Пример #4
0
        private void UpdateARPTableBeforeRun()
        {
            IpFinder finder = new IpFinder();

            finder.UpdateARPTable();
        }
Пример #5
0
 public MACHandler()
 {
     finder = new IpFinder();
     //finder.UpdateARPTable(); //cập nhật lại bảng ARP 1 lần cho 1 lần xử lý toàn bộ MAC
 }