Exemplo n.º 1
0
        public async Task GetServicesList()
        {
            // Create a HTTPWebRequest to download the list of services the device offers
            var message = new GetServicesMessage(this.serviceDescriptionUrl, this.hostEndPoint, _logger);

            using (var response = await _httpClient.SendAsync(message.Encode(), message.Method).ConfigureAwait(false))
            {
                OnServicesReceived(response);
            }
        }
Exemplo n.º 2
0
        async Task <UpnpNatDevice> GetServicesList(IPAddress localAddress, Uri deviceServiceUri, CancellationToken token)
        {
            // Create a HTTPWebRequest to download the list of services the device offers
            var request = new GetServicesMessage(deviceServiceUri).Encode(out byte[] body);

            if (body.Length > 0)
            {
                Log.Error("Services Message unexpectedly contained a message body");
            }
            using (token.Register(() => request.Abort()))
                using (var response = (HttpWebResponse)await request.GetResponseAsync().WithCancellation(token).ConfigureAwait(false))
                    return(await ServicesReceived(localAddress, deviceServiceUri, response, token).ConfigureAwait(false));
        }
Exemplo n.º 3
0
        internal void GetServicesList(NatDeviceCallback callback)
        {
            // Save the callback so i can use it again later when i've finished parsing the services available
            this.callback = callback;

            // Create a HTTPWebRequest to download the list of services the device offers
            byte[]     body;
            WebRequest request = new GetServicesMessage(this.serviceDescriptionUrl, this.hostEndPoint).Encode(out body);

            if (body.Length > 0)
            {
                NatUtility.Log("Error: Services Message contained a body");
            }
            request.BeginGetResponse(this.ServicesReceived, request);
        }