Exemplo n.º 1
0
        internal AcceptorI(EndpointI endpoint, Instance instance, string adapterName, string host, int port)
        {
            _endpoint = endpoint;
            _instance = instance;
            _adapterName = adapterName;
            _backlog = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);

            //
            // .NET requires that a certificate be supplied.
            //
            X509Certificate2Collection certs = instance.certs();
            if(certs.Count == 0)
            {
                Ice.SecurityException ex = new Ice.SecurityException();
                ex.reason = "IceSSL: certificate required for server endpoint";
                throw ex;
            }

            try
            {
                int protocol = instance.protocolSupport();
                _addr = IceInternal.Network.getAddressForServer(host, port, protocol, instance.preferIPv6()) as
                    IPEndPoint;
                _fd = IceInternal.Network.createServerSocket(false, _addr.AddressFamily, protocol);
                IceInternal.Network.setBlock(_fd, false);
                IceInternal.Network.setTcpBufSize(_fd, _instance);
                if(IceInternal.AssemblyUtil.platform_ != IceInternal.AssemblyUtil.Platform.Windows)
                {
                    //
                    // Enable SO_REUSEADDR on Unix platforms to allow
                    // re-using the socket even if it's in the TIME_WAIT
                    // state. On Windows, this doesn't appear to be
                    // necessary and enabling SO_REUSEADDR would actually
                    // not be a good thing since it allows a second
                    // process to bind to an address even it's already
                    // bound by another process.
                    //
                    // TODO: using SO_EXCLUSIVEADDRUSE on Windows would
                    // probably be better but it's only supported by recent
                    // Windows versions (XP SP2, Windows Server 2003).
                    //
                    IceInternal.Network.setReuseAddress(_fd, true);
                }
            }
            catch(System.Exception)
            {
                _fd = null;
                throw;
            }
        }
Exemplo n.º 2
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(IceInternal.EndpointI obj)
        {
            if (!(obj is EndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            EndpointI p = (EndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            return(_delegate.CompareTo(p._delegate));
        }
Exemplo n.º 3
0
        internal AcceptorI(EndpointI endpoint, Instance instance, IceInternal.Acceptor del, string adapterName)
        {
            _endpoint    = endpoint;
            _delegate    = del;
            _instance    = instance;
            _adapterName = adapterName;

            //
            // .NET requires that a certificate be supplied.
            //
            if (instance.certs().Count == 0)
            {
                Ice.SecurityException ex = new Ice.SecurityException();
                ex.reason = "IceSSL: certificate required for server endpoint";
                throw ex;
            }
        }
Exemplo n.º 4
0
        internal AcceptorI(EndpointI endpoint, Instance instance, IceInternal.Acceptor del, string adapterName)
        {
            _endpoint = endpoint;
            _delegate = del;
            _instance = instance;
            _adapterName = adapterName;

            //
            // .NET requires that a certificate be supplied.
            //
            if(instance.certs().Count == 0)
            {
                Ice.SecurityException ex = new Ice.SecurityException();
                ex.reason = "IceSSL: certificate required for server endpoint";
                throw ex;
            }
        }
Exemplo n.º 5
0
 public WSSInfoI(EndpointI e)
 {
     _endpoint = e;
 }
Exemplo n.º 6
0
 public IceInternal.EndpointI create(List<string> args, bool oaEndpoint)
 {
     IceInternal.IPEndpointI endpt = new EndpointI(_instance);
     endpt.initWithOptions(args, oaEndpoint);
     return endpt;
 }
Exemplo n.º 7
0
 public InfoI(EndpointI e)
 {
     _endpoint = e;
 }
Exemplo n.º 8
0
 public IceInternal.EndpointI create(List <string> args, bool oaEndpoint)
 {
     IceInternal.IPEndpointI endpt = new EndpointI(_instance);
     endpt.initWithOptions(args, oaEndpoint);
     return(endpt);
 }
Exemplo n.º 9
0
 //
 // Return an acceptor for this endpoint, or null if no acceptor
 // is available. In case an acceptor is created, this operation
 // also returns a new "effective" endpoint, which might differ
 // from this endpoint, for example, if a dynamic port number is
 // assigned.
 //
 public override IceInternal.Acceptor acceptor(ref IceInternal.EndpointI endpoint, string adapterName)
 {
     AcceptorI p = new AcceptorI(_instance, adapterName, _host, _port);
     endpoint = new EndpointI(_instance, _host, p.effectivePort(), _timeout, connectionId_, _compress);
     return p;
 }
Exemplo n.º 10
0
 public IceInternal.EndpointI listen()
 {
     _endpoint = _endpoint.endpoint(_delegate.listen());
     return _endpoint;
 }
Exemplo n.º 11
0
 public IceInternal.EndpointI listen()
 {
     try
     {
         _addr = IceInternal.Network.doBind(_fd, _addr);
         IceInternal.Network.doListen(_fd, _backlog);
     }
     catch(SystemException)
     {
         _fd = null;
         throw;
     }
     _endpoint = _endpoint.endpoint(this);
     return _endpoint;
 }