protected Server() { #if FULLFRAMEWORK this.fSslOptions = new SslConnectionFactory(); #endif #if FULLFRAMEWORK if (Socket.OSSupportsIPv4) { fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; } // This is a workaround for Mono 2.10 / Mac // Socket.OSSupportsIPv6 there fails with ArgumentException Boolean lIsIPv6Supported; try { lIsIPv6Supported = Socket.OSSupportsIPv6; } catch (ArgumentException) { lIsIPv6Supported = (Environment.OS != OperatingSystem.Windows); // Mono reports Unix platform for MacOSX } if (lIsIPv6Supported) { fBindingV6 = new ServerBinding(); fBindingV6.Address = IPAddress.IPv6Any; fBindingV6.AddressFamily = AddressFamily.InterNetworkV6; } #else fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; #endif if (fBindingV4 == null && fBindingV6 == null) { throw new Exception("This host's network stack supports neither IPv4 nor IPv6 Internet Protocol"); } Timeout = Connection.DEFAULT_TIMEOUT; TimeoutEnabled = true; MaxLineLength = Connection.DEFAULT_MAX_LINE_LENGTH; MaxLineLengthEnabled = true; CloseConnectionsOnShutdown = true; BindV4 = true; BindV6 = true; }
protected Server() { fBindings = new ServerBindings(); #if FULLFRAMEWORK if (Socket.SupportsIPv4) { fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; } // This is a workaround for Mono 2.10 / Mac // Socket.OSSupportsIPv6 there fails with ArgumentException Boolean lIsIPv6Supported = false; try { lIsIPv6Supported = Socket.OSSupportsIPv6; } catch (ArgumentException) { lIsIPv6Supported = (Environment.OSVersion.Platform == PlatformID.Unix); // Mono reports Unix platform for MacOSX } if (lIsIPv6Supported) { fBindingV6 = new ServerBinding(); fBindingV6.Address = IPAddress.IPv6Any; fBindingV6.AddressFamily = AddressFamily.InterNetworkV6; } #else fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; #endif if (fBindingV4 == null && fBindingV6 == null) { throw new Exception("This host's network stack supports neither IPv4 nor IPv6 Internet Protocol"); } Timeout = Connection.DEFAULT_TIMEOUT; TimeoutEnabled = true; MaxLineLength = Connection.DEFAULT_MAX_LINE_LENGTH; MaxLineLengthEnabled = true; }
protected Server() { #if FULLFRAMEWORK this.fSslOptions = new SslConnectionFactory(); #endif #if FULLFRAMEWORK if (Socket.SupportsIPv4) { fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; } // This is a workaround for Mono 2.10 / Mac // Socket.OSSupportsIPv6 there fails with ArgumentException Boolean lIsIPv6Supported; try { lIsIPv6Supported = Socket.OSSupportsIPv6; } catch (ArgumentException) { lIsIPv6Supported = (Environment.OSVersion.Platform == PlatformID.Unix); // Mono reports Unix platform for MacOSX } if (lIsIPv6Supported) { fBindingV6 = new ServerBinding(); fBindingV6.Address = IPAddress.IPv6Any; fBindingV6.AddressFamily = AddressFamily.InterNetworkV6; } #else fBindingV4 = new ServerBinding(); fBindingV4.Address = IPAddress.Any; fBindingV4.AddressFamily = AddressFamily.InterNetwork; #endif if (fBindingV4 == null && fBindingV6 == null) throw new Exception("This host's network stack supports neither IPv4 nor IPv6 Internet Protocol"); Timeout = Connection.DEFAULT_TIMEOUT; TimeoutEnabled = true; MaxLineLength = Connection.DEFAULT_MAX_LINE_LENGTH; MaxLineLengthEnabled = true; }