예제 #1
0
        public override async Task CreatePortMap(Mapping mapping)
        {
            CreatePortMappingMessage message = new CreatePortMappingMessage(mapping, localAddress, this);

            using (await _httpClient.SendAsync(message.Encode(), message.Method).ConfigureAwait(false))
            {
            }
        }
예제 #2
0
        public override async Task <Mapping> CreatePortMapAsync(Mapping mapping)
        {
            var message  = new CreatePortMappingMessage(mapping, LocalAddress, this);
            var response = await SendMessageAsync(message).ConfigureAwait(false);

            if (!(response is CreatePortMappingResponseMessage))
            {
                throw new MappingException(ErrorCode.Unknown, "Invalid response received when creating the port map");
            }
            return(mapping);
        }
예제 #3
0
        /// <summary>
        ///  Maps the specified port to this computer
        /// </summary>
        public override IAsyncResult BeginCreatePortMap(Mapping mapping, AsyncCallback callback, object asyncState)
        {
            CreatePortMappingMessage message = new CreatePortMappingMessage(mapping, localAddress, this);

            return(BeginMessageInternal(message, callback, mapping, EndCreatePortMapInternal));
        }
예제 #4
0
        public override Task CreatePortMap(Mapping mapping)
        {
            CreatePortMappingMessage message = new CreatePortMappingMessage(mapping, localAddress, this);

            return(_httpClient.SendAsync(message.Encode(), message.Method));
        }