Esempio n. 1
0
        /// <summary>
        /// Constructor 1.
        /// </summary>
        internal SoapUdpSocket( SoapUdpTransportOptions options )
        {
            if ( options == null )
                throw new ArgumentNullException( "options" );

            _options = options.Clone( ) as SoapUdpTransportOptions;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor 2.
        /// </summary>
        internal SoapUdpSocket( IPEndPoint localEP, SoapUdpTransportOptions options )
        {
            if ( localEP == null )
                throw new ArgumentNullException( "endpoint" );

            if ( options == null )
                throw new ArgumentNullException( "options" );

            _options = options.Clone( ) as SoapUdpTransportOptions;

            Bind( localEP );
        }
Esempio n. 3
0
        /// <summary>
        /// Parameterized constructor
        /// </summary>
        public SoapUdpTransport( XmlNodeList configData )
        {
            //
            // Set default transport options, override with config settings if needed.
            //
            _formatter = new SoapPlainFormatter( );
            _options = new SoapUdpTransportOptions( );
            //
            // Process any configuration data
            //
            if ( configData != null )
            {
                string value;

                foreach ( XmlNode node in configData )
                {
                    XmlElement child = node as XmlElement;

                    if ( child != null )
                    {
                        switch ( child.LocalName )
                        {
                            case "exclusiveAddressUse":
                                //
                                // SO_EXCLUSIVEADDRUSE
                                //
                                value = child.GetAttribute( "enabled" );
                                _options.ExclusiveAddressUse = Convert.ToBoolean( value );
                                break;
                            case "defaultPort":
                                //
                                // Default Port
                                //
                                value = child.GetAttribute( "value" );
                                _options.DefaultPort = Convert.ToInt32( value );
                                break;
                            case "reuseAddress":
                                //
                                // Default Port
                                //
                                value = child.GetAttribute( "enabled" );
                                _options.ReuseAddress = Convert.ToBoolean( value );
                                break;
                            default:
                                //
                                // Ignore rather than fail
                                //
                                break;
                        }
                    }
                }
            }

            //
            // Retrieve the short and full host names for the machine, plus the external
            // network interface addresses.
            //
            IPHostEntry hostEntry = Dns.GetHostEntry( Dns.GetHostName( ) );

            foreach ( IPAddress address in hostEntry.AddressList )
            {
                if ( !IPAddress.IsLoopback( address ) )
                    _hostAddresses.Add( address );
            }

            _longHostName = hostEntry.HostName;

            int dotindex = _longHostName.IndexOf( '.' );

            if ( dotindex != -1 )
                _shortHostName = _longHostName.Substring( 0, dotindex );
            else
                _shortHostName = _longHostName;
            //
            // Registering for AppDomain.ProcessExit allows us to shutdown cleanly.
            //
            AppDomain.CurrentDomain.ProcessExit += new EventHandler( OnProcessExit );
        }
        /// <summary>
        /// To Be Provided.
        /// </summary>
        public object Clone( )
        {
            SoapUdpTransportOptions clone = new SoapUdpTransportOptions( );

            clone.DefaultPort = _defaultPort;
            clone.ExclusiveAddressUse = _exclusiveUse;
            clone.ReuseAddress = _reuse;

            return clone;
        }