/// <summary>
        /// Creates an instance of a DpwsClient class with a specified eventing callback port number.
        /// </summary>
        public DpwsClient(Binding localBinding, ProtocolVersion v)
        {
            m_threadLock               = new object();
            m_eventClient              = new DpwsEventingClient(v);
            m_mexClient                = new DpwsMexClient(v);
            m_eventCallbacks           = new WsServiceOperations();
            m_callbackServiceEndpoints = new WsServiceEndpoints();
            m_blockingCall             = true;
            m_ignoreRequestFromThisIP  = true;
            m_localBinding             = localBinding;
            m_version                  = v;

            m_discoClient = new DpwsDiscoveryClient(this, v);

            // Add the Hello and Bye discovery disco services
            ClientDiscoveryService = new DpwsDiscoClientService(this, v);

            // Start a Udp discovery service host
            WsUdpServiceHost.Instance.AddServiceEndpoint(ClientDiscoveryService);
            WsUdpServiceHost.Instance.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP;
            WsUdpServiceHost.Instance.MaxThreadCount = 5;
            WsUdpServiceHost.Instance.Start(new ServerBindingContext(v));
        }
        /// <summary>
        /// Creates an instance of a DpwsClient class with a specified eventing callback port number.
        /// </summary>
        public DpwsClient(Binding localBinding, ProtocolVersion v)
        {
            m_threadLock               = new object();
            m_eventClient              = new DpwsEventingClient(v);
            m_mexClient                = new DpwsMexClient(v);
            m_eventCallbacks           = new WsServiceOperations();
            m_callbackServiceEndpoints = new WsServiceEndpoints();
            m_blockingCall             = true;
            m_ignoreRequestFromThisIP  = true;
            m_localBinding             = localBinding;
            m_version                  = v;

            m_discoClient = new DpwsDiscoveryClient(this, v);

            // Add the Hello and Bye discovery disco services
            ClientDiscoveryService = new DpwsDiscoClientService(this, v);

            // Start a Udp discovery service host
            WsUdpServiceHost.Instance.AddServiceEndpoint(ClientDiscoveryService);
            WsUdpServiceHost.Instance.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP;
            WsUdpServiceHost.Instance.MaxThreadCount = 5;
            WsUdpServiceHost.Instance.Start(new ServerBindingContext(v));

            // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back
            // to this client
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd"));

            // Add callbacks implemented by this client
            m_callbackServiceEndpoints.Add(this);

            // Start the Http service host
            m_httpServiceHost = new WsHttpServiceHost(m_localBinding, m_callbackServiceEndpoints);
            m_httpServiceHost.MaxThreadCount = m_callbackServiceEndpoints.Count;
            m_httpServiceHost.Start(new ServerBindingContext(v));
            System.Ext.Console.Write("Http service host started...");
        }
Exemple #3
0
        private void Init()
        {
            m_discoClient = new DpwsDiscoveryClient(this);

            // Set the initial endpoint address
            m_endpointAddress = "urn:uuid:" + Guid.NewGuid();

            // Add the Hello and Bye discovery disco services
            ClientDiscoveryService = new DpwsDiscoClientService(this);
            m_discoServiceEndpoints.Add(ClientDiscoveryService);

            // Start a Udp discovery service host
            m_udpSeviceHost = new WsUdpServiceHost(m_discoServiceEndpoints);
            if (!m_udpSeviceHost.IsRunning)
            {
                m_udpSeviceHost.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP;
                m_udpSeviceHost.MaxThreadCount = 5;
                m_udpSeviceHost.Start();
                System.Ext.Console.Write("Udp service host started...");
            }
            else
                m_udpSeviceHost = null;

            // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back
            // to this client
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd"));

            // Add callbacks implemented by this client
            m_callbackServiceEndpoints.Add(this);

            // Start the Http service host
            m_httpServiceHost = new WsHttpServiceHost(m_port, m_callbackServiceEndpoints);
            m_httpServiceHost.MaxThreadCount = m_callbackServiceEndpoints.Count;
            m_httpServiceHost.Start();
            System.Ext.Console.Write("Http service host started...");
        }
Exemple #4
0
 /// <summary>
 /// Internal callback used by DpwsDiscoClient to update DpwsDiscoService when the ws-discovery version changes.
 /// The method deletes the current DpwsDiscoService from the listening services collection and ads a new one
 /// that when created will have the new disco versino information.
 /// </summary>
 /// <param name="discoVersion">A DiscoVersion object containing the new ws-discovery version information.</param>
 internal void UpdateDiscoVersion()
 {
     m_discoServiceEndpoints.Remove(ClientDiscoveryService);
     ClientDiscoveryService = new DpwsDiscoClientService(this);
     m_discoServiceEndpoints.Add(ClientDiscoveryService);
 }