IsRunningOnMono() protected static method

protected static IsRunningOnMono ( ) : System.Boolean
return System.Boolean
Exemplo n.º 1
0
        public override void Open()
        {
            try
            {
                if (CloseConnectionsOnShutdown)
                {
                    this.fWorkers = new ArrayList();
                }
                else
                {
                    this.fWorkers = null;
                }

                Int32 lActualPort = this.Port;

                Boolean lBindV6 = (this.BindingV6 != null) && this.BindV6;

                if (lBindV6)
                {
                    this.BindingV6.BindUnthreaded();
                    this.BindingV6.ListeningSocket.Listen(this.BindingV6.MaxWaitConnections);
                    this.BindingV6.ListeningSocket.BeginAccept(new AsyncCallback(AcceptCallback), this.BindingV6.ListeningSocket);
                    lActualPort = ((System.Net.IPEndPoint) this.BindingV6.ListeningSocket.LocalEndPoint).Port;
                }

                // There is a chance that this will fail on Mono
                // Unfortunately this code shouldn't fail on Mac while it WILL fail on Linux
                // And no one can warrant that suddenly the Mono/Linu bug won't be fixed
                if (this.BindingV4 != null && this.BindV4)
                {
                    try
                    {
                        this.BindingV4.BindUnthreaded();
                        this.BindingV4.ListeningSocket.Listen(this.BindingV4.MaxWaitConnections);
                        this.BindingV4.ListeningSocket.BeginAccept(new AsyncCallback(AcceptCallback), this.BindingV4.ListeningSocket);
                        lActualPort = ((System.Net.IPEndPoint) this.BindingV4.ListeningSocket.LocalEndPoint).Port;
                    }
                    catch (SocketException)
                    {
                        if (!(lBindV6 && Server.IsRunningOnMono()))
                        {
                            throw;
                        }
                    }
                }

                if (lActualPort != this.Port)
                {
                    this.Port = lActualPort;
                }

                this.fActive = true;
            }
            catch (Exception)
            {
                this.Close();
                throw;
            }
        }
Exemplo n.º 2
0
        public override void Open()
        {
            try
            {
#if FULLFRAMEWORK
                if (this.SslOptions.Enabled)
                {
                    this.SslOptions.LoadCertificate();
                }
#endif

                this.fWorkers = CloseConnectionsOnShutdown ? new ArrayList() : null;

                Int32 lActualPort = this.Port;

                Boolean lBindV6 = (this.BindingV6 != null) && this.BindV6;

                if (lBindV6)
                {
                    this.BindingV6.BindUnthreaded();
                    this.BindingV6.ListeningSocket.Listen(this.BindingV6.MaxWaitConnections);
                    this.BindingV6.ListeningSocket.BeginAccept(AcceptCallback, this.BindingV6.ListeningSocket);
                    lActualPort = ((System.Net.IPEndPoint) this.BindingV6.ListeningSocket.LocalEndPoint).Port;
                }

                // There is a chance that this will fail on Mono
                // Unfortunately this code shouldn't fail on Mac while it WILL fail on Linux
                // And no one can warrant that suddenly the Mono/Linux issue won't be fixed
                if (this.BindingV4 != null && this.BindV4)
                {
                    try
                    {
                        this.BindingV4.BindUnthreaded();
                        this.BindingV4.ListeningSocket.Listen(this.BindingV4.MaxWaitConnections);
                        this.BindingV4.ListeningSocket.BeginAccept(AcceptCallback, this.BindingV4.ListeningSocket);
                        lActualPort = ((System.Net.IPEndPoint) this.BindingV4.ListeningSocket.LocalEndPoint).Port;
                    }
                    catch (SocketException)
                    {
                        if (!(lBindV6 && Server.IsRunningOnMono()))
                        {
                            throw;
                        }
                    }
                }

                this.Port = lActualPort;

                this.fActive = true;
            }
            catch (Exception)
            {
                this.Close();
                throw;
            }
        }
Exemplo n.º 3
0
        public virtual void Open()
        {
            try
            {
#if FULLFRAMEWORK
                if (this.SslOptions.Enabled)
                {
                    this.SslOptions.LoadCertificate();
                }
#endif

                Int32 lActualPort = this.Port;

                Boolean lBindV6 = (this.fBindingV6 != null) && this.fBindV6;
                if (lBindV6)
                {
                    this.fBindingV6.EnableNagle = EnableNagle;
                    this.fBindingV6.Bind(new Listener(this, this.GetWorkerClass()));
                    lActualPort = ((System.Net.IPEndPoint) this.fBindingV6.ListeningSocket.LocalEndPoint).Port;
                }

                // There is a chance that this will fail on Mono
                // Unfortunately this code shouldn't fail on Mac while it WILL fail on Linux
                // And no one can warrant that suddenly this Mono/Linux issue won't be fixed
                if (this.fBindV4 && (this.fBindingV4 != null))
                {
                    try
                    {
                        if (this.Port == 0)
                        {
                            this.fBindingV4.Port = lActualPort;
                        }
                        this.fBindingV4.EnableNagle = EnableNagle;
                        this.fBindingV4.Bind(new Listener(this, this.GetWorkerClass()));
                        lActualPort = ((System.Net.IPEndPoint) this.fBindingV4.ListeningSocket.LocalEndPoint).Port;
                    }
                    catch (SocketException)
                    {
                        if (!(lBindV6 && Server.IsRunningOnMono()))
                        {
                            throw;
                        }
                    }
                }

                this.Port = lActualPort;

                this.fActive = true;
            }
            catch
            {
                this.Close();
                throw;
            }
        }
Exemplo n.º 4
0
        public virtual void Open()
        {
            try
            {
                Int32 lActualPort = this.Port;

                Boolean lBindV6 = (this.fBindingV6 != null) && this.fBindV6;
                if (lBindV6)
                {
                    this.fBindingV6.EnableNagle = EnableNagle;
                    this.fBindingV6.Bind(new Listener(this, this.GetWorkerClass()));
                    lActualPort = ((System.Net.IPEndPoint) this.fBindingV6.ListeningSocket.LocalEndPoint).Port;
                }

                if ((this.fBindV4 && (this.fBindingV4 != null)) &&
                    !(lBindV6 && Server.IsRunningOnMono()))
                {
                    if (this.Port == 0)
                    {
                        this.fBindingV4.Port = lActualPort;
                    }
                    this.fBindingV4.EnableNagle = EnableNagle;
                    this.fBindingV4.Bind(new Listener(this, this.GetWorkerClass()));
                    lActualPort = ((System.Net.IPEndPoint) this.fBindingV4.ListeningSocket.LocalEndPoint).Port;
                }

                if (this.Port != lActualPort)
                {
                    this.Port = lActualPort;
                }

                this.fActive = true;
            }
            catch
            {
                this.Close();
                throw;
            }
        }