예제 #1
0
        HostedUdpTransportConfigurationImpl()
        {
            List <string> bindingInfoList = GetBindingInfoList();

            baseAddresses = new List <Uri>();
            foreach (string bindingInfo in bindingInfoList)
            {
                int port;
                if (!int.TryParse(bindingInfo, out port))
                {
                    throw new InvalidDataException(string.Format("The binding information '{0}' is invalid for the protocol '{1}'",
                                                                 bindingInfo, UdpConstants.Scheme));
                }

                // FUTURE: Use configured host from WAS config as HTTP case.
                UriBuilder builder = new UriBuilder(UdpConstants.Scheme, "localhost", port,
                                                    HostingEnvironment.ApplicationVirtualPath);

                baseAddresses.Add(builder.Uri);
            }

            // FUTURE: add support with multiple transport managers.
            transportManager = new HostedUdpTransportManager(baseAddresses[0]);
            UdpTransportManager.Add(transportManager);
        }
        HostedUdpTransportConfigurationImpl()
        {
            List<string> bindingInfoList = GetBindingInfoList();

            baseAddresses = new List<Uri>();
            foreach (string bindingInfo in bindingInfoList)
            {
                int port;
                if (!int.TryParse(bindingInfo, out port))
                {
                    throw new InvalidDataException(string.Format("The binding information '{0}' is invalid for the protocol '{1}'",
                        bindingInfo, UdpConstants.Scheme));
                }

                // FUTURE: Use configured host from WAS config as HTTP case.
                UriBuilder builder = new UriBuilder(UdpConstants.Scheme, "localhost", port,
                    HostingEnvironment.ApplicationVirtualPath);

                baseAddresses.Add(builder.Uri);
            }

            // FUTURE: add support with multiple transport managers.
            transportManager = new HostedUdpTransportManager(baseAddresses[0]);
            UdpTransportManager.Add(transportManager);
        }